Spring Boot-style @injectable autowiring for Python — zero manual wiring, any DI backend.
Project description
django-autowired
Spring Boot-style
@injectableautowiring for Python. Any DI backend. Zero manual wiring.
Why
In large Django / FastAPI / Flask codebases, hand-rolling injector.Module subclasses
with binder.bind(IRepository, to=SqlRepository) calls does not scale. It's boilerplate,
it's easy to forget, and every new service becomes a coordination problem.
django-autowired brings the Spring Boot ergonomic to Python: decorate a class with
@injectable, point an AppConfig (or FastAPI lifespan, or Flask extension) at the
packages to scan, and the rest happens at boot.
Features
| Zero wiring | No Module subclasses, no binder.bind() calls. Just @injectable. |
| Backend-agnostic | Works with injector, lagom, wireup, or dishka. Swap with one line. |
| Framework-agnostic core | Django, FastAPI, Flask, or plain Python — all first-class. |
| Fail loud at boot | Duplicate bindings, missing backends, and unresolvable types raise typed errors. |
| Test-friendly | Pytest fixtures, overrides, and a context manager ship with the library. |
| Thread-safe registry | Concurrent registration is safe by construction. |
| Introspection | python -m django_autowired inspect prints your DI graph as a table, tree, JSON, or Mermaid diagram. |
Quickstart (Django)
# myapp/apps.py
from django_autowired.integrations.django import AutowiredAppConfig
class MyAppConfig(AutowiredAppConfig):
name = "myapp"
autowired_packages = ["myapp.services", "myapp.adapters"]
# myapp/services.py
from django_autowired import injectable
@injectable()
class GreetingService:
def greet(self) -> str:
return "hello"
# myapp/views.py
from django_autowired import container
from myapp.services import GreetingService
def index(request):
svc = container.get(GreetingService)
return HttpResponse(svc.greet())
That's it. No modules. No binder. No manual wiring.
Backend support
| Backend | Status | Priority | Notes |
|---|---|---|---|
injector |
✅ | default | Most complete. Thread scope supported. |
lagom |
✅ | Auto-resolves concretes from type hints. | |
wireup |
✅ | Thread scope falls back to singleton. | |
dishka |
✅ | Rebuild-on-override semantics. |
Install the backend you want:
pip install "django-autowired[injector]" # default
pip install "django-autowired[lagom]"
pip install "django-autowired[wireup]"
pip install "django-autowired[dishka]"
Framework support
| Framework | Status | Priority |
|---|---|---|
| Django | ✅ | priority |
| FastAPI | ✅ | |
| Flask | ✅ | |
| Plain Python | ✅ |
Installation
pip install django-autowired # core only (no backend)
pip install "django-autowired[injector]" # default backend
pip install "django-autowired[django,injector]" # Django + injector
pip install "django-autowired[fastapi,injector]" # FastAPI + injector
pip install "django-autowired[flask,injector]" # Flask + injector
pip install "django-autowired[dev]" # everything + test/lint/docs
Or with uv:
uv add "django-autowired[django,injector]"
Documentation
Full docs at tylersuehr7.github.io/django-autowired.
- Quickstart
@injectableguide- Scopes
- Django integration
- FastAPI integration
- Flask integration
- Testing guide
License
MIT © 2026 Tyler R. Suehr
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 django_autowired-0.2.4.tar.gz.
File metadata
- Download URL: django_autowired-0.2.4.tar.gz
- Upload date:
- Size: 55.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8d0a8e019d70d43230dd1717af2f67ea51ea53c38e64ce9a26e035cb5ca9bb3
|
|
| MD5 |
13c63ac44390faaed8a5ace7d71cd38c
|
|
| BLAKE2b-256 |
28bbb4c54e817c7745e477830bc7bbb85ab47afb5c7303760f291f3a6f5aedaa
|
Provenance
The following attestation bundles were made for django_autowired-0.2.4.tar.gz:
Publisher:
publish.yml on tylersuehr7/django-autowired
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_autowired-0.2.4.tar.gz -
Subject digest:
f8d0a8e019d70d43230dd1717af2f67ea51ea53c38e64ce9a26e035cb5ca9bb3 - Sigstore transparency entry: 1342780026
- Sigstore integration time:
-
Permalink:
tylersuehr7/django-autowired@7b20875720255c6452deda96161b9637fcc31169 -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/tylersuehr7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7b20875720255c6452deda96161b9637fcc31169 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_autowired-0.2.4-py3-none-any.whl.
File metadata
- Download URL: django_autowired-0.2.4-py3-none-any.whl
- Upload date:
- Size: 26.2 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 |
f5bca5294c4d2f481ce3ed5caf47af0b4bce50799d190db694c6998253c2c8ea
|
|
| MD5 |
1712cfa1633f2518a22d65bc3ad88f28
|
|
| BLAKE2b-256 |
793ca0ac42f6f7df8fc1ae1af843405cb1ca8717c2d1cdb1df926e77a1d4c493
|
Provenance
The following attestation bundles were made for django_autowired-0.2.4-py3-none-any.whl:
Publisher:
publish.yml on tylersuehr7/django-autowired
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_autowired-0.2.4-py3-none-any.whl -
Subject digest:
f5bca5294c4d2f481ce3ed5caf47af0b4bce50799d190db694c6998253c2c8ea - Sigstore transparency entry: 1342780051
- Sigstore integration time:
-
Permalink:
tylersuehr7/django-autowired@7b20875720255c6452deda96161b9637fcc31169 -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/tylersuehr7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7b20875720255c6452deda96161b9637fcc31169 -
Trigger Event:
release
-
Statement type: