Installation¶
| Extra | Adds | For |
|---|---|---|
ninja-devx[dishka] |
dishka |
ninja_devx.contrib.dishka.DishkaResolver |
ninja-devx[svcs] |
svcs |
ninja_devx.contrib.svcs.SvcsResolver |
ninja-devx[otel] |
opentelemetry-api |
ninja_devx.contrib.otel.OpenTelemetryHook |
ninja-devx[client] |
httpx |
generated Python clients |
ninja-devx[contract] |
schemathesis |
the ninja_contract pytest fixture |
ninja-devx[guardian] |
django-guardian |
the guardian object-permission backend |
ninja-devx[s3] |
boto3 |
presigned S3 uploads |
ninja-devx[crypto] |
cryptography |
encrypted webhook signing secrets |
ninja-devx[orjson] |
orjson |
the fast ORJSON renderer |
ninja-devx[msgspec] |
msgspec |
the msgspec renderer |
ninja-devx[redis] |
redis |
ninja_devx.contrib.redis_throttle.RedisThrottleStorage |
ninja-devx[structlog] |
structlog |
binding request identity to structlog.contextvars in RequestLogMiddleware |
ninja-devx[zeal] |
django-zeal |
runtime N+1 detection (ninja_devx.contrib.nplusone) |
ninja-devx[filters] |
django-filter |
filterset_class on list endpoints |
ninja-devx[rules] |
rules |
ninja_devx.contrib.rules.HasRule |
Requirements: Python 3.11+, Django 4.2+ and django-ninja 1.7+. See Support and stability for the tested matrix.
Configure Django¶
INSTALLED_APPS = [
# ...
"ninja_devx", # management commands and system checks
]
NINJA_DEVX = { # optional: every key has a default
"PAGINATION_CLASS": "ninja.pagination.PageNumberPagination",
"CHECK_APIS": ["config.urls.api"],
}
All keys are listed in the settings reference. The pytest plugin loads automatically; no configuration is needed.
Editor and type checker¶
The package ships py.typed. For model field types in your own code, enable the
django-stubs mypy plugin:
[mypy]
strict = true
plugins = mypy_django_plugin.main
[mypy.plugins.django-stubs]
django_settings_module = config.settings
Next¶
- Quickstart: a working API in five minutes.
- Tutorial: the blog example, step by step.
- Guides: find the page for a task.
- Inspecting controllers: see what a configuration resolves to.