Drop-in replacement for the Modal Python SDK, backed by MIOSA compute
Project description
miosa-modal-shim
Drop-in replacement for the Modal Python SDK that routes all compute to MIOSA instead. Existing Modal scripts run on MIOSA with zero code changes.
Installation
# Replace modal with the MIOSA shim
pip uninstall modal
pip install miosa-modal-shim
The package installs a modal Python module that shadows the real Modal SDK.
All import modal statements resolve to this shim.
Configuration
Set your MIOSA API key:
export MIOSA_API_KEY="mki_..."
The shim also reads MODAL_TOKEN_ID as a fallback, so existing CI
configurations that set Modal credentials continue to work after you swap
the key value.
Usage
Your existing Modal code works unchanged:
import modal
app = modal.App("my-app")
@app.function(gpu="any", image=modal.Image.debian_slim().pip_install("torch"))
def train(data):
import torch
return torch.tensor(data).sum().item()
# Runs on a MIOSA sandbox with a GPU
result = train.remote(data=[1, 2, 3])
print(result) # 6.0
Execution modes
| Method | Where it runs |
|---|---|
fn.local(...) |
Current process, no sandbox |
fn(...) |
Same as local |
fn.remote(...) |
MIOSA sandbox (ephemeral VM) |
fn.map(iter1, iter2) |
Parallel MIOSA sandboxes (up to 10 concurrent) |
Image builder
image = (
modal.Image.debian_slim(python_version="3.11")
.apt_install("git", "ffmpeg")
.pip_install("torch", "transformers")
.run_commands("echo 'setup done'")
)
Secrets
# From explicit dict
secret = modal.Secret.from_dict({"HF_TOKEN": "hf_..."})
# From environment (reads MYAPP_* env vars)
secret = modal.Secret.from_name("myapp")
@app.function(secrets=[secret])
def inference():
...
Volumes
vol = modal.Volume.from_name("training-data", create_if_missing=True)
@app.function(volumes={"/data": vol})
def process():
...
Volumes provide API compatibility. Persistent cross-sandbox storage is on the roadmap.
What is supported
| Feature | Status |
|---|---|
modal.App / modal.Stub |
Fully supported |
@app.function() |
Fully supported |
@app.cls() |
Construction only |
modal.Image (debian_slim, from_registry, pip/apt/run_commands) |
Fully supported |
modal.Volume |
API-compatible stub |
modal.Secret (from_name, from_dict) |
Fully supported |
function.remote() |
Fully supported |
function.local() |
Fully supported |
function.map() |
Fully supported |
| GPU selection (T4, L4, A10G, A100, H100, L40S) | Fully supported |
Not yet supported
modal.web_endpoint/modal.asgi_app/modal.wsgi_appmodal.Cronmodal.Dict/modal.Queue- Class method-level
.remote()dispatch
License
MIT
Project details
Release history Release notifications | RSS feed
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 miosa_modal_shim-0.1.0.tar.gz.
File metadata
- Download URL: miosa_modal_shim-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45451bbf6ab4bd2e27841494ddcaf7637f2e2961cf4bdb90b187b141e0fbcefc
|
|
| MD5 |
06ab651628de2b8bf2b0c1065f125823
|
|
| BLAKE2b-256 |
5ffef312e52abfa2960924ef7bcb3c82dc83365625d6e2991e2f5f21f57b9781
|
File details
Details for the file miosa_modal_shim-0.1.0-py3-none-any.whl.
File metadata
- Download URL: miosa_modal_shim-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7aa00805673569a70388a0056ca1d3fe79b11804c09dab19da16a113fab5844
|
|
| MD5 |
84ee79278e13a88e643d1bdaa72f3b74
|
|
| BLAKE2b-256 |
bdd37687be50ed7e28cca94186f319d62efea3d149876bcdfa6cf281d6efc59d
|