Skip to main content

No project description provided

Project description

Modulith

Build once. Scale everywhere. Share effortlessly.

Modulith is a framework for building systems as composable, shareable modules.

Start simple.
Structure as modules.
Scale by distributing them, without rewriting your code.

🚀 What You Get

  • 🧱 Scalable by design — move from local → distributed seamlessly
  • 🔗 Composable architecture — build systems by combining modules
  • 🌐 Shareable modules — publish and reuse across projects
  • 🔌 Unified interface — local and remote calls look identical
  • 🔐 Built-in access control — safely expose your modules

📦 Install

pip install modulith

🚀 Quick Start

Everything runs locally. No network. No infra.

# calculator.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
  • Fast
  • No latency
  • Easy to debug

🌐 Share

Turn any module into a shareable, remote module in seconds.

# Serve the module on your machine
modulith serve calculator.module \ 
--public \                  # Accessible by anyone
--rate-limit 100 \          # 100 requests per minute (public users)
--burst-limit 20            # Allow short bursts up to 20 requests
🔑 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

🔌 Use Anywhere

Connect to your module from any environment:

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.

⚖️ Effortless Scaling

Scale horizontally by running multiple instances of the same module.

# On another machine
modulith serve calculator.module \ 
--public \                      
--rate-limit 100 \              
--burst-limit 20 \
--auth-token ...            # Use the same token above to join the same module pool

What happens automatically:

  • Instances join the same module pool
  • Requests are load-balanced across instances
  • If one instance goes down, others continue serving requests

🔗 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:
    return calculator("add", kwargs={"a": a, "b": b}) + calculator("add", kwargs={"a": a, "b": b})  # calls remote calculator module

result = new_module("double_sum", kwargs={"a": 1, "b": 2})
#  → 6

Execution flow

inputs → double_sum(1, 2)
       → add(1, 2)   (remote)
       → 3           (return)
       → add(1, 2)   (remote)
       → 3           (cache hit, return)
       → 3 + 3       (local)
       → 6

⚡ Design Philosophy

function → capability → module → composition → system
  • Functions become capabilities
  • Capabilities form modules
  • Modules compose into systems

👤 Optional: Create Account

Avoid manual owner token management by linking modules to your account.

modulith signup # Create an account (if you don't have one)
modulith login
modulith serve calculator.module
🌐 Module 'calculator' is live:
- Repository: <your_username>/calculator
...

Your module is now automatically registered and managed under your account.

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

modulith-0.1.1.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modulith-0.1.1-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file modulith-0.1.1.tar.gz.

File metadata

  • Download URL: modulith-0.1.1.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modulith-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dfb240aef15152bf14214f8dfac9d1dabba8e4d90d1b8e666c48437174315395
MD5 670e00e74f3e795088dfa4a5eeb7069a
BLAKE2b-256 db8e51a212e3b3d954818df4973bf3e23af3bf8b9e68d1958b5ec18322f2369d

See more details on using hashes here.

Provenance

The following attestation bundles were made for modulith-0.1.1.tar.gz:

Publisher: python-publish.yml on modulith-labs/modulith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modulith-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: modulith-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modulith-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 caa05431e0d07805729eac5ac15ac6533866d11077f57cc58d55c7ccffa17a73
MD5 3f2698c4916dc0d4cf3285129673e0cd
BLAKE2b-256 683c2ea822fc2cb04167caca3ca9d2098ecb41bbe4f9b45eaa64a407b4400680

See more details on using hashes here.

Provenance

The following attestation bundles were made for modulith-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on modulith-labs/modulith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page