A cozy, beginner-friendly IDE with a warm mocha aesthetic. Built with PyQt6/PySide6 and designed for developers who want a pleasant coding environment without overwhelming complexity.
- Warm, pastel color palette inspired by cafΓ© aesthetics
- Easy on the eyes for long coding sessions
- JetBrains Mono font for optimal code readability
- Smooth, rounded UI elements
Mocha Codespace supports 12+ programming languages out of the box:
| Language | File Extension | Execution Method |
|---|---|---|
| π Python | .py |
Interpreted with Python |
| β Java | .java |
Compiled with javac, run with java |
| βοΈ C | .c |
Compiled with gcc |
| βοΈ C++ | .cpp |
Compiled with g++ |
| π JavaScript | .js |
Run with Node.js or browser |
| π TypeScript | .ts |
Compiled with tsc, run with Node.js |
| π¦ Rust | .rs |
Compiled with rustc |
| πΉ Go | .go |
Run with go run |
| π C# | .cs |
Run with dotnet |
| π Ruby | .rb |
Interpreted with Ruby |
| π¨ Kotlin | .kt |
Compiled with kotlinc, run with java |
| π HTML/CSS | .html, .css |
Opened in default browser |
| π Lua | .lua |
Interpreted with Lua |
| βοΈ Nix | .nix |
Run with nix-shell |
- Auto-indentation: Smart indenting based on code structure
- Tab-to-spaces: Inserts 4 spaces when you press Tab
- Undo/Redo: Full edit history support
- Find text: Quick search functionality
- Line numbers: Visual feedback with line numbering
- Smart code completion: Context-aware indentation for blocks
- File tree navigation: Browse and open files from a workspace folder
- Tab management: Multiple files open simultaneously
- Quick file switching: Easy navigation between open files
- Auto-save prompts: Never lose your work
- One-click run: Execute code directly from the IDE
- Compilation handling: Automatic compilation for compiled languages
- Console output: See program output and errors in real-time
- Error reporting: Clear compilation and runtime error messages
- Threaded execution: Run code without freezing the UI
- Create new files with language templates
- Open existing files
- Save and Save As functionality
- Automatic file extension handling
- Smart file type detection
Required:
- Python 3.8 or higher
- One of: PyQt6 or PySide6
Optional (but recommended):
- Pygments (for enhanced syntax highlighting)
Language-specific requirements (install only what you need):
- Java: JDK 8+ (with
javacandjavain PATH) - C/C++: GCC or Clang
- Rust: Rust toolchain (
rustc) - Go: Go compiler
- TypeScript: Node.js + TypeScript (
npm install -g typescript) - C#: .NET SDK
- Ruby: Ruby interpreter
- Kotlin: Kotlin compiler
- Lua: Lua interpreter
- Nix: Nix package manager
- Clone the repository
git clone https://github.com/vanilla-deve/MochaCodespace.git
cd MochaCodespace- Install dependencies
Choose either PyQt6 or PySide6:
# Option A: PyQt6 (recommended)
pip install PyQt6 pygments
# Option B: PySide6
pip install PySide6 pygments- Run the application
python main.pyYou can compile Mocha Codespace into a standalone executable using PyInstaller:
# Install PyInstaller
pip install pyinstaller
# Create executable
pyinstaller --onefile --windowed --name "MochaCodespace" \
--icon=icon.ico \
--add-data "README.md:." \
main.py
# Executable will be in dist/MochaCodespace.exepip install pyinstaller
pyinstaller --onefile --windowed --name "MochaCodespace" \
--icon=icon.icns \
--add-data "README.md:." \
main.py
# App bundle will be in dist/MochaCodespace.apppip install pyinstaller
pyinstaller --onefile --name "mocha-codespace" \
--add-data "README.md:." \
main.py
# Executable will be in dist/mocha-codespaceRun Mocha Codespace in a container with all language support:
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc g++ make \
default-jdk \
nodejs npm \
&& npm install -g typescript
# Install Python dependencies
RUN pip install PyQt6 pygments
# Copy application
COPY mocha_codespace.py /app/
WORKDIR /app
CMD ["python", "mocha_codespace.py"]-
Start Mocha Codespace
python main.py
If you created an executable, just run it!
-
Create or Open a File
- Click "π New" to create a new file
- Select your language from the dropdown
- The editor will load with a helpful template
-
Write Your Code
- Use auto-indentation by pressing Enter
- Auto-pairs will close your brackets
- Press Ctrl+S to save
-
Run Your Code
- Click "
βΆοΈ Run" or press F5 - Watch the output in the console below
- Click "
-
Open a Workspace (Optional)
- Click "π Open Workspace"
- Browse through your project files
- Double-click to open files
| Shortcut | Action |
|---|---|
Ctrl+N |
New file |
Ctrl+O |
Open file |
Ctrl+S |
Save file |
Ctrl+Shift+S |
Save As |
Ctrl+W |
Close tab |
Ctrl+F |
Find text |
Ctrl+Z |
Undo |
Ctrl+Y |
Redo |
F5 |
Run code |
Tab |
Insert 4 spaces |
- Files are run with your system Python interpreter
- No compilation needed
- Class name must match filename (e.g.,
Hello.javaβclass Hello) - Automatically compiles before running
- Compiled
.classfiles appear in the same directory
- Requires GCC/G++ compiler in PATH
- Creates
.outexecutable files - Compilation errors appear in console
- Automatically compiles to JavaScript
- If Node.js available, runs the compiled JS
- Otherwise, opens in browser
- Opens directly in your default web browser
- Great for quick web development
βββββββββββββββββββββββββββββββββββββββ
β MochaCodespace (QMainWindow) β
β βββββββββββββββββββββββββββββββ β
β β Toolbar & Menu Bar β β
β βββββββββββββββ¬ββββββββββββββββ€ β
β β β β β
β β Workspace β Tab Widget β β
β β Tree β βββββββββββ β β
β β (Optional) β β Editor β β β
β β β β Tabs β β β
β β β βββββββββββ β β
β β βββββββββββββββββ€ β
β β β Console β β
β βββββββββββββββ΄ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββ
-
CodeEditor (QPlainTextEdit)
- Handles text editing with custom key event processing
- Implements auto-indentation and auto-pairs
- Applies Mocha theme styling
-
EditorTab (QWidget)
- Wraps CodeEditor with file management
- Handles save/load operations
- Manages file paths and language settings
-
RunnerThread (QThread)
- Executes code in background thread
- Prevents UI freezing during execution
- Captures stdout/stderr for console display
-
MochaCodespace (QMainWindow)
- Main application window
- Coordinates all components
- Manages menus, toolbar, and workspace
- User clicks "Run" β
run_code()method called - File is saved (if unsaved, prompts user)
- Language detected β appropriate runner selected
- For compiled languages:
- Compilation command executed synchronously
- Errors displayed in console
- If successful, proceeds to execution
- Execution command passed to
RunnerThread - Thread runs code asynchronously
- Output streamed to console in real-time
If Pygments is installed, Mocha uses it for advanced syntax highlighting:
- Token-based parsing
- Language-specific lexers
- Custom color mapping to Mocha theme
Without Pygments, falls back to basic regex-based highlighting.
Edit the stylesheet in setup_ui() method to customize colors:
# Mocha color palette
background = "#faf7f2" # Main background
panel = "#f5ebe0" # Panels and editor
highlight = "#e3d5ca" # Selection and hover
border = "#d5bdaf" # Borders
text = "#704241" # Text color
accent = "#9a8c98" # Accent color- Add language configuration to
LANG_CONFIG:
"NewLang": {
"ext": ".ext",
"sample": "examples/hello.ext",
"comment": "// ",
"runner": lambda f: ["command", str(f)]
}- Add sample code to
SAMPLE_CODE:
"NewLang": """// Sample code here
print("Hello World")
"""- Add execution logic in
get_run_command()if needed for compilation.
Contributions are welcome! Here's how you can help:
- Report Bugs: Open an issue with details
- Suggest Features: Share your ideas in issues
- Submit Pull Requests: Fork, code, and PR
- Improve Documentation: Help others understand
- Share: Tell others about Mocha Codespace
# Clone repo
git clone https://github.com/vanilla-deve/MochaCodespace.git
cd MochaCodespace
# Create virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
# Install dev dependencies
pip install PyQt6 pygments black flake8 pytest
# Run tests
pytest tests/
# Format code
black main.pyThis project is licensed under the GNU GPL v3.0 License - see the LICENSE file for details.
- PyQt6/PySide6: Qt bindings for Python
- Pygments: Syntax highlighting library
- JetBrains: For the beautiful JetBrains Mono font
- Community: For feedback and contributions
- Plugin system for extensions
- Git integration
- Code snippets library
- Integrated terminal
- Debugger support
- Auto-completion (LSP integration)
- Export to various formats


