Skip to main content

rn-forge-django

Documentation · Changelog · Source · All pykit packages

Opinionated Django/DRF integration layer built on top of rn-forge-commons and rn-forge-web.

Install

Require the package by version range:

uv add "rn-forge-django[all]>=0.6,<0.7"

Application code imports rn_forge.web directly (wire models, pagination, problem types, the auth contract), and this package does not re-export it. Declare rn-forge-web as well, so the import is not an undeclared transitive dependency:

uv add "rn-forge-web>=0.3,<0.4"

Optional extras:

Extra Adds
drf Django REST Framework integration (views, serializers, exceptions, pagination, idempotency, concurrency, casing)
transfer django-import-export + rn-forge-data (tablib, openpyxl), for rn_forge.django.drf.transfer: tabular export and import, batch create and delete
openapi drf-spectacular, for drf.openapi
oidc rn-forge-auth[oidc] (pyjwt[crypto]), for auth.drf.oidc JWKS bearer auth
redis rn-forge-auth[redis], the Redis client for Django's Redis cache backend that holds login transactions and revoked session IDs
celery celery, for the celery app factory
fixtures rn-forge-data[pandas], for building Django JSON fixtures from Excel workbooks
all Everything above

What's inside

  • models — Abstract model base classes: BaseModel (status enum field, audit timestamps, natural-key fixture support via NaturalKeyLookupManager/FixtureModelMixin, opt-in full_clean()-on-save), DateModel, DateRangeModel, TruncateModelMixin; the opt-in VersionedModelMixin/ImmutableModelMixin; and SequenceGenerator over an abstract counter.
  • auth — An installable Django app (rn_forge.django.auth, label rn_forge_django_auth) that binds rn-forge-auth to Django and DRF: routes (the /auth URLconf and its configuration), sessions (django.contrib.sessions sessions with timeouts and revocation), csrf (CSRF middleware and settings), stores (login transactions and replay records in Django's cache), rate_limit, audit (audit events), accounts and models (the default account resolver and its link and state tables), authorization (the default authorization context provider), and auth.drf (session and bearer authentication, permission-key and resource-policy hooks, serializers and the management viewsets).
  • drf — DRF integration outside the auth app: drf.views (base view classes, mixins, PermissionByMethodMixin), drf.routers (CustomMethodRouter, AIP-136 colon custom methods), drf.transfer (transfer extra: tabular export/import, batch create/delete), drf.serializers (base serializer, custom fields), drf.exceptions (the RFC 9457 problem handler and the legacy handler), drf.pagination (AIP-158 cursor pagination), drf.idempotency, drf.concurrency, drf.casing (camelCase renderer/parser) and drf.openapi (drf-spectacular; openapi extra).
  • tracing (otel extra) — instrument(): OpenTelemetry instrumentation for Django, called once before Django loads.
  • messaging — transactional outbox/inbox: abstract models, make_outbox_relay, process_event (bus and handler registry come from rn_forge.commons.integration.messaging).
  • celery (celery extra) — make_app and RETRYABLE_TASK_KWARGS.
  • settings — rn_forge_django_settings: a typed, frozen-dataclass settings facade built from the Django RN_FORGE_DJANGO setting dict, auto-reloaded on override_settings/setting_changed.
  • fixtures — Builds Django JSON fixtures from Excel workbooks (requires the fixtures extra).
  • urls / views — Reusable standalone views (including the readiness_view factory and debug_request) and URLconf; utils carries the require_settings/require_environment startup guards.

The HTTP wire semantics — problem bodies, preconditions, pagination tokens, idempotency keys, readiness reports, the auth contract — are rn-forge-web's. Everything here that touches them is an adapter, and tests/test_conformance.py drives the shared conformance table through a Django application wired from them.

Dependencies and package behavior

  • rn-forge-web is a base dependency: five modules are adapters over it.
  • rn-forge-auth is a base dependency: auth binds its login flows, stores, Principal, Requirement and authorization contracts to Django and DRF.
  • drf-spectacular (openapi extra) supplies the OpenAPI schema integration.
  • drf.casing supplies the camelCase renderer and parser.
  • oidc extra — JWKS verification is rn-forge-auth[oidc] (PyJWT); auth.drf.oidc only binds it to DRF.
  • celery extra — supplies the Celery app factory.
  • Migrations. The auth app has one, for the external-account link and account-state tables. SequenceGenerator's counter is abstract and adds no table.

Configuration

Settings are read from a single RN_FORGE_DJANGO dict in your Django settings module, e.g.:

RN_FORGE_DJANGO = {
    "AUTH": {"PROBLEM_TYPE_BASE": "https://errors.example.com/"},
    "DRF": {
        "TRANSFER": {"MAX_ROWS": 10_000},
        "PAGINATION": {"PAGE_SIZE": 50, "MAX_PAGE_SIZE": 200},
        "CASING": {"ENABLED": True},
    },
}

To use the bundled auth app, add "rn_forge.django.auth" to INSTALLED_APPS.

Development

From the repo root or this directory:

uv run pytest packages/rn-forge-django             # all tests
uv run pytest packages/rn-forge-django -m unit      # fast isolated tests
uv run pytest packages/rn-forge-django -m integration  # database-backed tests
uv run ruff check packages/rn-forge-django
uv run pyright

Tests configure Django directly in tests/conftest.py (sqlite in-memory database) — there is no separate Django settings module. Test-only models and their tables follow the convention in that file's docstring.

Metadata

Release files for rn-forge-django 0.6.1

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

Source distribution (sdist)

Source distribution for rn-forge-django 0.6.1
File Size Uploaded Provenance Actions
rn_forge_django-0.6.1.tar.gz 86.3 kB With provenance Details for rn_forge_django-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rn-forge-django 0.6.1
File Interpreter ABI Platform Actions
rn_forge_django-0.6.1-py3-none-any.whl Python 3 none any Details for rn_forge_django-0.6.1-py3-none-any.whl

Total release size: 198.3 kB

Release files / rn_forge_django-0.6.1.tar.gz

Download URL rn_forge_django-0.6.1.tar.gz
Size 86.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6a6e21c57f3fda2d7b54a19bae4f126cf9b1c17391072f5c8c20cd6143d8f7e8
BLAKE2b-256 checksum
How to use checksums
025b201d0a312f9bd88622798aeb7d29d1a5cfa11483f7849dd92b13a92416a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / rn_forge_django-0.6.1-py3-none-any.whl

Download URL rn_forge_django-0.6.1-py3-none-any.whl
Size 112.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ee85c6fd578b8a692f2937a807dac966092c4f259a8288511bf34c0e309676c
BLAKE2b-256 checksum
How to use checksums
2edc60dd361b3cc8512feb9c3f75640e2be8c4fa7cb3f8c80baf5dc8147cf3c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for rn-forge-django 0.6.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rn_forge_django-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

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