No project description provided
Project description
Modulith
Build once. Run everywhere. Scale effortlessly.
Modulith lets you focus on your application logic, not deployment infrastructure. Structure your code as modules once, then run them locally and remotely, and scale across instances without touching your code.
🚀 What You Get
- 🧱 Scalable by design — move from local → distributed seamlessly
- 🔗 Composable — build systems by combining modules, local or remote
- 🌐 Shareable — publish and reuse modules across projects
- 🔐 Built-in access control — rate limits, burst limits, auth tokens
📦 Install
pip install modulith
🚀 Quick Start
Define a module and call it locally:
# calculator/module.py
from modulith import Modulith
module = Modulith("calculator")
@module.capability("add")
def add(a: float, b: float) -> float:
return a + b
result = module("add", kwargs={"a": 1, "b": 2}) # → 3
Or run it from the CLI:
modulith run calculator.module add --kwargs '{"a": 1, "b": 2}' # → 3
🐳 Build and Publish
Package your module as a Docker image and push it to Docker Hub:
modulith build calculator.module
modulith push <docker-image>
# or
modulith build calculator.module --push
Once published, you can serve or deploy your module on any machine, no local source code needed.
🌐 Serve Your Module
Expose your module over the network with access controls:
# From source
modulith serve \
--source calculator.module \
--public \ # Accessible by anyone
--rate-limit 100 \ # 100 requests/minute
--burst-limit 20 # Allow short bursts
# From Docker Hub
modulith serve \
--image <docker-image> \
--public \
--rate-limit 100 \
--burst-limit 20
You'll see:
🔑 Your authentication token: ...
🌐 Module 'calculator' is live:
- Repository: user3bef3/calculator
- Public URL: https://6ebm5g.instatunnel.my
- Local URL: http://localhost:8000
⚙️ Capabilities:
- add(a: float, b: float) → float
⚡ Public access limits:
- Rate limit: 100 requests/minute
- Burst limit: 20 requests
🛑 Press Ctrl+C to stop
Run your module from any machine:
calculator = Modulith.remote(
"user3bef3/calculator",
access_token="..."
)
result = calculator("add", kwargs={"a": 1, "b": 2}) # → 3 (executed remotely)
Same interface. Local or remote, no difference.
⚖️ Deploy at Scale
Scale horizontally across multiple instances (e.g. AWS Fargate):
# From source
modulith deploy \
--source calculator.module \
--instances 5 \
--cpus 2 \
--memory 1GB \
--public \
--rate-limit 100 \
--burst-limit 20 \
--auth-token <your-auth-token>
# From Docker Hub
modulith deploy \
--image <docker-image> \
--instances 5 \
--cpus 2 \
--memory 1GB \
--public \
--rate-limit 100 \
--burst-limit 20 \
--auth-token <your-auth-token>
Tip: Use the same
--auth-tokenacross all instances to group them into the same pool. Different tokens = separate pools.
🔗 Compose Modules
Build new modules by calling existing modules, local or remote:
new_module = Modulith()
calculator = Modulith.remote("user3bef3/calculator", access_token="...")
@new_module.capability("double_sum")
def double_sum(a: float, b: float) -> float:
sum1 = calculator("add", kwargs={"a": a, "b": b})
sum2 = calculator("add", kwargs={"a": a, "b": b}) # cache hit
return sum1 + sum2
result = new_module("double_sum", kwargs={"a": 1, "b": 2}) # → 6
Execution flow:
double_sum(1, 2)
→ add(1, 2) [remote] → 3
→ add(1, 2) [cache] → 3
→ 3 + 3 → 6
👤 Account (Optional)
Skip manual token management by linking modules to your account:
modulith signup # Create an account
modulith login
Once logged in, your module is automatically registered under your username:
🌐 Module 'calculator' is live:
- Repository: <your_username>/calculator
...
CLI Reference
| Command | Description |
|---|---|
modulith signup |
Create a new account and get an authentication token |
modulith login |
Log in to your account and store the authentication token securely |
modulith run |
Run a capability locally |
modulith build |
Package module as a Docker image |
modulith push |
Push image to Docker Hub |
modulith serve |
Serve module on current machine |
modulith deploy |
Deploy module on remote machine |
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 modulith-0.1.7.tar.gz.
File metadata
- Download URL: modulith-0.1.7.tar.gz
- Upload date:
- Size: 40.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07caf6f801ed5f3bc82908a06a341fdcafaefa0557443c26a08522502f7cfb3f
|
|
| MD5 |
da79c686f064cc4401e0fe96be1927da
|
|
| BLAKE2b-256 |
b3850099bbf43a6f221f16d7c8404bb1fb1fe8c4fac639de048ca7e6bd160c68
|
Provenance
The following attestation bundles were made for modulith-0.1.7.tar.gz:
Publisher:
python-publish.yml on modulith-labs/modulith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modulith-0.1.7.tar.gz -
Subject digest:
07caf6f801ed5f3bc82908a06a341fdcafaefa0557443c26a08522502f7cfb3f - Sigstore transparency entry: 1280960761
- Sigstore integration time:
-
Permalink:
modulith-labs/modulith@b4a71748c097121030b6a99fa4fb69cea47b0f87 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/modulith-labs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@b4a71748c097121030b6a99fa4fb69cea47b0f87 -
Trigger Event:
release
-
Statement type:
File details
Details for the file modulith-0.1.7-py3-none-any.whl.
File metadata
- Download URL: modulith-0.1.7-py3-none-any.whl
- Upload date:
- Size: 66.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c0cece38fe73ebb603e679d570d8b41cbb69d91df9c4c99976008d6315769d6
|
|
| MD5 |
6e9eee22c30f1703447990dc95edf3ce
|
|
| BLAKE2b-256 |
76bee6adc20a3c7becf71c15d5b1866326aeb00c933be5f03005d87b645710fb
|
Provenance
The following attestation bundles were made for modulith-0.1.7-py3-none-any.whl:
Publisher:
python-publish.yml on modulith-labs/modulith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modulith-0.1.7-py3-none-any.whl -
Subject digest:
3c0cece38fe73ebb603e679d570d8b41cbb69d91df9c4c99976008d6315769d6 - Sigstore transparency entry: 1280960767
- Sigstore integration time:
-
Permalink:
modulith-labs/modulith@b4a71748c097121030b6a99fa4fb69cea47b0f87 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/modulith-labs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@b4a71748c097121030b6a99fa4fb69cea47b0f87 -
Trigger Event:
release
-
Statement type: