mrmd-python
Independent Python runtime for MRMD notebooks. Runs as a daemon process with full GPU memory isolation.
Features
- Independent daemon process - survives if parent dies, variables persist
- GPU memory isolation - kill daemon to release VRAM (critical for vLLM)
- Auto venv detection - uses current venv or
VIRTUAL_ENV - Registry-based discovery - find runtimes via
~/.mrmd/runtimes/ - Full MRP protocol - execute, completions, inspect, variables, streaming
Installation
# With uv
uv pip install mrmd-python
# Or run directly without installing
uvx mrmd-python
Quick Start
# Start a daemon runtime (auto-detects venv)
mrmd-python
# The daemon runs in background. Use the API:
curl http://localhost:PORT/mrp/v1/capabilities
# List running runtimes
mrmd-python --list
# Kill when done (releases GPU memory)
mrmd-python --kill default
CLI Reference
# Start daemon
mrmd-python # Start with ID "default"
mrmd-python --id vllm # Start with custom ID
mrmd-python --venv /path/venv # Use specific venv
mrmd-python --port 8000 # Use specific port
# Management
mrmd-python --list # List all running runtimes
mrmd-python --info ID # Get runtime details
mrmd-python --kill ID # Kill a runtime
mrmd-python --kill-all # Kill all runtimes
# Development
mrmd-python --foreground # Run in foreground (no daemon)
Virtual Environment Detection
When --venv is not specified, mrmd-python auto-detects:
- Current venv (if running inside one via
sys.prefix) VIRTUAL_ENVenvironment variable- Falls back to system Python
API Endpoints
All endpoints at /mrp/v1/:
| Endpoint | Method | Purpose |
|---|---|---|
/capabilities |
GET | Runtime info and features |
/sessions |
GET/POST | List/create sessions |
/sessions/{id} |
GET/DELETE | Get/destroy session |
/execute |
POST | Run code |
/execute/stream |
POST | Run code with SSE streaming |
/complete |
POST | Get completions |
/inspect |
POST | Get symbol documentation |
/hover |
POST | Get hover tooltip |
/variables |
POST | List user variables |
/variables/{name} |
POST | Get variable details |
/is_complete |
POST | Check if code is complete |
/format |
POST | Format code with black |
Architecture
~/.mrmd/
├── runtimes/
│ └── {id}.json # Registry: pid, port, url, venv, cwd
└── logs/
└── {id}.log # Daemon logs
Each runtime is a fully independent process:
- Double-forked daemon (survives parent death)
- Own IPython shell with persistent variables
- HTTP server on auto-assigned port
- Registered in
~/.mrmd/runtimes/for discovery
GPU Memory Management
For vLLM and other GPU workloads, memory is only released when the process dies:
# Load model in runtime
mrmd-python --id vllm
# ... use the model ...
# Release GPU memory
mrmd-python --kill vllm
Programmatic Usage
from mrmd_python import create_app
import uvicorn
# Create app (daemon_mode=True for use inside daemon)
app = create_app(
cwd="/path/to/project",
venv="/path/to/venv",
daemon_mode=True,
)
uvicorn.run(app, host="localhost", port=8000)
Protocol
See PROTOCOL.md for the full MRP specification.
Metadata
Release files for mrmd-python 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mrmd_python-0.4.2.tar.gz | 56.6 kB | Without provenance | Details for mrmd_python-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mrmd_python-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for mrmd_python-0.4.2-py3-none-any.whl |
Total release size: 101.7 kB
Release files / mrmd_python-0.4.2.tar.gz
| Download URL | mrmd_python-0.4.2.tar.gz |
|---|---|
| Size | 56.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c25362e48748febd00f17436c470507f91005604e1f9ec4329250208d40460a
|
|
BLAKE2b-256 checksum How to use checksums |
1f83023b686c61dae6206dd3d170b6fcf19a6b97941c59db64e974c1a6b4d01b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / mrmd_python-0.4.2-py3-none-any.whl
| Download URL | mrmd_python-0.4.2-py3-none-any.whl |
|---|---|
| Size | 45.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df5ab077ee27a518b8285a1189ecc8e3c5e2bbd9a1928ccdbc42bd07895e05b5
|
|
BLAKE2b-256 checksum How to use checksums |
5a27f88f232f2f4a04cdaddeab1c67d43ab60949aced2e940e8aa8795f1f6207
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for mrmd-python 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.