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.6 · Alpha. Routing, validation, app/ORM/Docker/test/admin scaffolding, basic async ORM, and admin backend services 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
Admin foundations Explicit model fields and permission-gated server-side data services

🚀 Quick start

You need Python 3.11+ and uv.

1. Create your project

uvx --from rusjango==0.1.6 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.

🛡️ Register models for admin services

uv run rusjango add admin

Set ADMIN = {"FACTORY": "admin:create_site"} in settings.py, then register explicit model fields in apps/school/admin.py. The site provides a catalog, paginated lists, details, and optional typed writes for trusted server callers.

No dashboard or HTTP admin routes are installed. Follow the admin tutorial for registration and exact permission grants.

🛠️ 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
add admin / remove admin Add/remove the tracked admin factory scaffold

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
Admin foundations Register visible fields and use trusted identities with exact grants

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.

Verified locally for 0.1.6: 155 tests passed on Python 3.11 and 3.14 with both CLIs and live PostgreSQL. Rust, distribution, installed-wheel, generated-test, and Docker persistence checks passed. See the Phase 5 validation record for evidence and hosted results.

🤝 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.

Authentication, the browser admin dashboard, OpenAPI/Swagger generation, workers, uploads, streaming, and supported WebSockets remain pending. Admin identities currently come from trusted server code; there is no login or HTTP authorization adapter. 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.6 release notes for compatibility changes.

📄 License

Rusjango is released under the MIT license.

Metadata

Release files for rusjango 0.1.6

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.6
File Size Uploaded Provenance Actions
rusjango-0.1.6.tar.gz 45.3 kB Without provenance Details for rusjango-0.1.6.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rusjango 0.1.6
File Actions
rusjango-0.1.6-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for rusjango-0.1.6-cp311-abi3-win_amd64.whl
rusjango-0.1.6-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.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rusjango-0.1.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for rusjango-0.1.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
rusjango-0.1.6-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for rusjango-0.1.6-cp311-abi3-macosx_11_0_arm64.whl
rusjango-0.1.6-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for rusjango-0.1.6-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 1.2 MB

Release files / rusjango-0.1.6.tar.gz

Download URL rusjango-0.1.6.tar.gz
Size 45.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bc0d5b7ca0a8fb6a0b598f898d6128740cf3ba44bf985ec3a6193e2c2889785c
BLAKE2b-256 checksum
How to use checksums
f850cde07e87fd0ec9fc6850e156bdd9d2ddb5552f78974549ff23b763d12027
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.6-cp311-abi3-win_amd64.whl

Download URL rusjango-0.1.6-cp311-abi3-win_amd64.whl
Size 138.1 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
53399902dc6da619e5c1b62ef2925a37db4cf371efc44d560d06ecd6e4bb7ad3
BLAKE2b-256 checksum
How to use checksums
7e401740ac6b76e5a0c16a47f9f03f4f6d1c9ac90c251bd0483c0633d8e538ef
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.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rusjango-0.1.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 271.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
0bdd1b0a6af67a519a68dd42e2e78fadf420bf718e6cf2199852b59eca7c0023
BLAKE2b-256 checksum
How to use checksums
7bfc0bcb711f9e98f8a81141a0b0466d780f1eccf83d58580a59726466cc8a66
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.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rusjango-0.1.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 264.8 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
367a8cf9287d06c4b2b1da38f5fee20401490bfce78c581db8cb3a3c6c8e03d0
BLAKE2b-256 checksum
How to use checksums
1ac535929b5ca950b5e186f84d5b875334d6b16f20e98d0611e01b93aa263999
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.6-cp311-abi3-macosx_11_0_arm64.whl

Download URL rusjango-0.1.6-cp311-abi3-macosx_11_0_arm64.whl
Size 240.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
85a26d6ef1db5ff93cbd77967050e90b90eaabc16ccecf8eb80be9640f80e423
BLAKE2b-256 checksum
How to use checksums
253f81fc711451aa0677c81408cea838a9bf2c713f6624bc7c7dd264516377e1
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.6-cp311-abi3-macosx_10_12_x86_64.whl

Download URL rusjango-0.1.6-cp311-abi3-macosx_10_12_x86_64.whl
Size 241.1 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6c92f5750c976fa99c09278065cb7608f86e4a9c00438ebea1d96ab56512f487
BLAKE2b-256 checksum
How to use checksums
381a0f9f3e051fb199dec31b4943775e9b8f9c37b8377c4774539e966d2ec47f
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.6

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