Use Marimo notebooks as your development environment.
Project description
🚀 python-modev
A development environment that uses Marimo notebooks as your primary development interface, inspired by nbdev. This tool allows you to write and organize your code in Marimo notebooks while maintaining a clean, exportable Python package structure.
📦 Installation
We recommend using UV for installation and package management as it provides better performance and reliability:
# Install UV if you haven't already
pip install uv
# Install python-modev
uv pip install python-modev
For library development, you can initialize a new project with UV:
uv init --lib
🚀 Quick Start
- Initialize a new project:
modev init
- Start your Marimo notebook:
marimo edit
- Export your code to Python files:
modev export
📁 Project Structure
After initialization, your project will have the following structure:
your-project/
├── modev.yaml # Configuration file
├── nbs/ # Your Marimo notebooks
└── src/your-project # Exported Python files
⚙️ Configuration
The modev.yaml file controls how your code is exported from notebooks to Python files. Here's an example configuration:
export_dir: src/modev
notebooks_dir: nbs
Configuration Options
source: Path to your Marimo notebookdestination: Where to export the Python filesexport_type:module: Export as a Python module (creates__init__.py)script: Export as a standalone script
📝 Export Directives
python-modev uses special directives in your Marimo notebooks to control code export:
#| export Directive
Use this directive to mark cells that should be exported to Python files:
#| export
def my_function():
"""This function will be exported"""
return "Hello, world!"
- Place
#| exportat the beginning of any cell you want to export - The exported code will include an origin comment showing which notebook and cell it came from
- All exported code from a notebook will be combined into a single Python file
#| default_exp Directive
Use this directive to specify the target filename for exported code:
#| default_exp my_module
- Place this directive in any cell (usually at the top of your notebook)
- The first
#| default_expdirective found will determine the output filename - If no
#| default_expis found, the notebook's name will be used - The
.pyextension is optional (will be added automatically if missing)
Example Notebook Structure
Initial cell
#| default_exp my_module.py
Following cells
#| export
def public_function():
"""This will be included in __all__"""
return "Public API"
#| export
def _private_function():
"""This won't be included in __all__"""
return "Internal use only"
🛠️ Usage
Initializing a Project
modev init
This command:
- Creates a basic project structure
- Sets up a default
modev.yaml - Initializes necessary directories
Exporting Code
modev export
This command:
- Reads your Marimo notebooks
- Extracts Python code marked with
#| export - Exports to the specified destinations in
modev.yaml - Automatically generates
__all__based on exported names (excluding those starting with_)
💡 Best Practices
-
Notebook Organization:
- Keep related code in the same notebook
- Use clear cell markers to separate different components
- Document your code using Marimo's markdown cells
-
Export Configuration:
- Group related functionality in the same destination
- Use module exports for packages
- Use script exports for standalone utilities
-
Development Workflow:
- Write and test code in Marimo notebooks
- Export frequently to ensure your Python files stay in sync
- Use version control to track changes in both notebooks and exported files
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_modev-0.1.2.tar.gz.
File metadata
- Download URL: python_modev-0.1.2.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8755446008a9df714b1e558245a53a5fa562a5613ceafcaea30dd2d9a7998c9
|
|
| MD5 |
3ce9b64170cc23140552cd110e5171b3
|
|
| BLAKE2b-256 |
57795f5b443eeb23fbf29bb528001cc7f31659d274ff50cef7521bd23754536b
|
File details
Details for the file python_modev-0.1.2-py3-none-any.whl.
File metadata
- Download URL: python_modev-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fdd3d6c5ac0faef49606c1278a02900337f902aa75ce24b4407fa59fb71d829
|
|
| MD5 |
cb7b68d3c16a15335600d73755275f0b
|
|
| BLAKE2b-256 |
2efe5a21fc8ffb51b5379acbca7c349218c49cd333dace4b91f05c19becce98d
|