Skip to main content

🦀 Rusjango

Async Python APIs. Django-style apps. Add features as you go.

PyPI Python CI License: MIT

📚 Documentation · 🚀 First steps · 📦 Releases · 💬 Issues

Rusjango is an async Python web framework that starts with a three-file project. Write a route, add an application, and enable a database when you need one.

🧪 Version 0.1.5 · Alpha. Routing, validation extensions, app/ORM/Docker/test scaffolding, and basic async ORM are implemented. The Rust CLI works today; the native runtime extension is a placeholder. Request handling currently runs in Python.

✨ What you can build with it

Feature What you get
Async APIs GET, POST, PUT, and DELETE handlers with JSON responses
Typed inputs Strict schemas, opt-in coercion, Field constraints, and synchronous validators
Organized apps Independent routers mounted under /api/<app>/
Async ORM SQLite and PostgreSQL create, read, update, and delete
Progressive scaffolding CLI commands that preserve custom APIs and unrelated settings
Middleware ASGI middleware, Host validation, and basic security headers
Two CLIs Python CLI in the package and a standalone Rust CLI
Docker and tests Nonroot container scaffold and isolated ASGI pytest fixture

🚀 Quick start

You need Python 3.11+ and uv.

1. Create your project

uvx --from rusjango==0.1.5 rusjango new demo
cd demo
uv sync

The scaffold starts with:

demo/
├── main.py
├── settings.py
└── pyproject.toml

2. Run it

uv run rusjango dev

Open http://127.0.0.1:8000/:

{"message": "Hello Rusjango"}

💡 Prefer pip? See the pip installation steps. Rust is needed for source builds, not for installing a compatible published wheel.

3. Write a typed API

Replace main.py with:

from rusjango import Rusjango, Schema

app = Rusjango(settings="settings.py")


class Greeting(Schema):
    name: str
    age: int | None = None


@app.get("/")
async def home():
    return {"message": "Hello Rusjango"}


@app.get("/hello/{name}")
async def hello(name: str, excited: bool = False):
    message = f"Hello {name}"
    return {"message": message + ("!" if excited else "")}


@app.post("/greetings")
async def create_greeting(data: Greeting):
    return data.dict()


app.load_installed_apps()

Try a path and query parameter:

curl "http://127.0.0.1:8000/hello/Ali?excited=true"
{"message": "Hello Ali!"}

Send a JSON body:

curl -X POST http://127.0.0.1:8000/greetings \
  -H "Content-Type: application/json" -d '{"name":"Ali"}'
{"name": "Ali", "age": null}

JSON schema types are strict: "20" is not an integer. Invalid input returns 422. Defaults make fields omittable; unknown JSON keys are ignored.

🧩 Add an application

Stop the server with Ctrl+C, then run:

uv run rusjango add app school
uv run rusjango dev

Visit http://127.0.0.1:8000/api/school/students.

Each app has its own Router(). The CLI creates its package and registers it in INSTALLED_APPS.

🗃️ Add a database

Stop the server again, then:

uv run rusjango add orm
uv run rusjango migrate
uv run rusjango dev

The untouched school starter now reads and writes SQLite:

curl -X POST http://127.0.0.1:8000/api/school/students \
  -H "Content-Type: application/json" -d '{"name":"Sara","age":22}'
curl http://127.0.0.1:8000/api/school/students

add orm adds model/schema files and upgrades an API only if it still matches the original starter. Custom API files are preserved.

💡 About migrations: migrate creates missing tables. It does not alter existing columns or move data. Run it explicitly before database-backed requests; startup does not create tables.

PostgreSQL is supported through the optional rusjango[postgres] dependency. Follow the ORM guide to configure it.

🐳 Containers and 🧪 application tests

uv run rusjango add tests
uv run --with pytest --with pytest-asyncio pytest tests

uv run rusjango add docker
export ALLOWED_HOSTS=localhost,127.0.0.1
docker compose build
docker compose run --rm web /app/.venv/bin/python -m rusjango migrate
docker compose up -d

Run the migration command only when ORM is enabled. Container settings disable debug and use a named volume for SQLite. Generated tests use an in-memory SQLite database per test.

remove docker and remove tests delete only unchanged tracked files and preserve edits. Follow the Docker guide and testing guide for configuration.

🛠️ CLI at a glance

Run these inside your project with uv run rusjango:

Command Purpose
new <name> Create a minimal project
dev Start the development server with reload
add app <name> Scaffold and register an app
remove app <name> Confirm, unregister, and delete an app
add orm Add SQLite configuration and ORM starter files
remove orm Disable ORM while keeping application files
migrate Create missing model tables
add docker / remove docker Add/remove unchanged tracked container files
add tests / remove tests Add/remove unchanged tracked pytest files

See the CLI reference for flags, naming rules, and preservation behavior.

📚 Learn step by step

Start here Then learn
First steps Install, create, run, and check your first API
Routes and requests Paths, query parameters, JSON bodies, and errors
Schemas Required fields, defaults, nesting, and validation
Applications Split your API into independent app packages
Async ORM Models, CRUD, SQLite, and PostgreSQL
Settings Configure apps, middleware, and database access
Middleware Wrap requests and use the built-in host checks
Docker Configure containers and persistent data
Application tests Run an ASGI client with isolated database fixtures

The documentation home also links to architecture, internals, validation, and release guides.

🔬 Develop from source

Clone the repository and install the development environment:

git clone https://github.com/babar-xagi/Rusjango.git
cd Rusjango
uv sync --all-packages --all-extras
cargo build -p rusjango-cli

cd examples/hello
uv run rusjango migrate
uv run rusjango dev

The repository pins Python 3.12. Set UV_PYTHON=3.14 to use Python 3.14. Windows and WSL virtual environments cannot be shared.

Phase 4 checks: 122 tests passed on Python 3.11 and 3.14 with both CLIs and live PostgreSQL. Rust checks, distribution builds, and fresh installed-wheel/generated-test checks passed. Container and hosted gates are recorded separately in the Phase 4 validation record.

🤝 Contributing · ✅ Validation record

🧭 Current scope

Rusjango is suitable for experimentation and contribution. It has one database configuration per process and no transaction API, relationships, or tracked schema migrations. SQLite needs 3.35+. Request bodies are buffered in memory.

Auth, admin, OpenAPI/Swagger generation, workers, uploads, streaming, and supported WebSockets remain pending. There are no benchmarks proving a performance advantage.

📌 Upgrading an old database? Earlier versions could use a default table named model. Back up the data and migrate it explicitly to the corrected table names. This release does not rename that table automatically.

Follow PROGRESS.md for implemented and planned phases, and the 0.1.5 release notes for compatibility changes.

📄 License

Rusjango is released under the MIT license.

Metadata

Release files for rusjango 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rusjango 0.1.5
File Size Uploaded Provenance Actions
rusjango-0.1.5.tar.gz 39.0 kB Without provenance Details for rusjango-0.1.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rusjango 0.1.5
File Actions
rusjango-0.1.5-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for rusjango-0.1.5-cp311-abi3-win_amd64.whl
rusjango-0.1.5-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for rusjango-0.1.5-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rusjango-0.1.5-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for rusjango-0.1.5-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
rusjango-0.1.5-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for rusjango-0.1.5-cp311-abi3-macosx_11_0_arm64.whl
rusjango-0.1.5-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for rusjango-0.1.5-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 1.2 MB

Release files / rusjango-0.1.5.tar.gz

Download URL rusjango-0.1.5.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
482ef6dfe17154a5bdf4151c3c4625a6886355931f3dd37fd88358abc78c7090
BLAKE2b-256 checksum
How to use checksums
71548b06b98f04f0ca186aa8be2cd7893400663d5339997ccffbe885ace0acde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rusjango-0.1.5-cp311-abi3-win_amd64.whl

Download URL rusjango-0.1.5-cp311-abi3-win_amd64.whl
Size 131.5 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2f2acb205df6369cefd8cfed2c63e928519791ae9cbe2dceb10b86c745fca274
BLAKE2b-256 checksum
How to use checksums
0dc632407325fac6fea00e8d623c0daae860c97db37e45b62f663a7cb08f8a67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rusjango-0.1.5-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rusjango-0.1.5-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 264.8 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
521d2f16eb8e015093010d9cb1c330aa18c48d37be0f28b01494dc8f97916796
BLAKE2b-256 checksum
How to use checksums
b760a2a8aeda309fb3f25119cb5c71b0195be439b6e837c23f9fee1c66aa396a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rusjango-0.1.5-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rusjango-0.1.5-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 258.3 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
16e0a61ea51a5946d0d69114a996961ce47699abb28e5d4fe8225d70a846ab64
BLAKE2b-256 checksum
How to use checksums
4498da4f9ad9b59883bf86c334ee7f5dff27487693eacde34dcfbda4f80651d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rusjango-0.1.5-cp311-abi3-macosx_11_0_arm64.whl

Download URL rusjango-0.1.5-cp311-abi3-macosx_11_0_arm64.whl
Size 234.3 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cbc078c91b7086b1c2138131275f24504dccf009c16c6a5c2c09ecd003ebd0e0
BLAKE2b-256 checksum
How to use checksums
920cd95bda8419371d7d60654b554b8401e1ca5c93699591c92e4d747a8520f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rusjango-0.1.5-cp311-abi3-macosx_10_12_x86_64.whl

Download URL rusjango-0.1.5-cp311-abi3-macosx_10_12_x86_64.whl
Size 234.6 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3259f7c223e7c4684a9ad24adc0f0def68439205cc8f286184a7644144de81da
BLAKE2b-256 checksum
How to use checksums
4181e4e685b0c3a10fbbef93469cf4010cb99fd4b61f31fe8303a4d9bd8206a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for rusjango 0.1.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page