Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

django-neolith

Deploy Django apps, not Django projects.

CI PyPI version Python versions Django versions License: BSD-3-Clause Code style: Ruff Checked with mypy

Status: alpha (0.1.0a1). The API may change before 0.1.

pip install --pre django-neolith

What it is

Neolith makes the Django app, not the Django project, the unit of deployment. An app can run inside a shared process or on its own as a service, with its models, migrations, admin and tests intact, and without changing its code. Apps talk to each other only through typed contracts, so the same code and the same tests hold in both arrangements. Neolith is defined by a specification that is independent of Django and of Python, and django-neolith is its reference implementation.

Features

What works on main today. The changelog has the details.

  • Typed contracts. A contract is a Protocol class with @contract and @action, and an implementation is marked with @implements. Request and reply types are Pydantic models in a portable type system, and every check runs when the module is imported.
  • Typed errors. ContractError carries a kind, a message and a detail. An action can declare its own error kinds with their detail records.
  • Calls cross as JSON, in-process too. Every request, reply and error detail is written and read through its declared type, so an in-process call carries exactly what a remote one will.
  • App declaration. An app declares what it provides, requires and owns on its NeolithAppConfig, and the declaration is checked when the class is defined.
  • Checks before serving. At start-up the host resolves every required contract to a provider and validates each implementation, listing every refusal in one error; once those pass, it runs its system checks on the settings and reports all their errors together.
  • One database per app. neolith.routers.AppRouter keeps each app's data on a database alias of its own.
  • Call context. A principal, a trace, a deadline and the calling app travel with each call. A root is opened for each request by RootMiddleware, and for a command or background work by command_scope.

Not yet on main: neolith run <app>, the HTTP transport, the conformance suite and events. See the roadmap below.

A short example

A contract, in a contract package other apps may import:

# inventory/contracts.py
from typing import Protocol

from pydantic import BaseModel

from neolith import action, contract


class ReserveRequest(BaseModel):
    sku: str
    qty: int


class ReserveReply(BaseModel):
    reserved: int


@contract("inventory.v1")
class Inventory(Protocol):
    @action(idempotent=True)
    def reserve(self, request: ReserveRequest) -> ReserveReply: ...

Its implementation, private to the app that provides it:

# inventory/services.py
from neolith import CallContext, implements

from inventory.contracts import Inventory, ReserveReply, ReserveRequest


@implements(Inventory)
class InventoryService:
    def reserve(self, request: ReserveRequest, ctx: CallContext) -> ReserveReply:
        return ReserveReply(reserved=request.qty)

The two apps' declarations:

# inventory/apps.py
from neolith import NeolithAppConfig, Provided

from inventory.contracts import Inventory


class InventoryConfig(NeolithAppConfig):
    name = "inventory"
    label = "inventory"
    provides = (
        Provided(
            Inventory,
            implementation="inventory.services.InventoryService",
            principal_from=("shop",),  # apps that may pass a principal on their calls
        ),
    )


# shop/apps.py
from neolith import NeolithAppConfig

from inventory.contracts import Inventory


class ShopConfig(NeolithAppConfig):
    name = "shop"
    label = "shop"
    requires = (Inventory,)

And a call from the shop app, which knows the contract and nothing else of inventory:

# shop/orders.py
from neolith import ContractError, connect

from inventory.contracts import ReserveRequest

inventory = connect("inventory.v1")


def place_order(sku: str, qty: int) -> int:
    try:
        reply = inventory.reserve(ReserveRequest(sku=sku, qty=qty))
    except ContractError as error:
        print(error.kind)  # "unavailable", "conflict", ...
        raise
    return reply.reserved

The settings neolith checks before the host serves, beside the project's usual ones such as DATABASES:

# settings.py
INSTALLED_APPS = ["inventory", "shop", "neolith"]
MIDDLEWARE = ["neolith.middleware.RootMiddleware"]  # first, and listed once
NEOLITH = {}

With these, a view in the shop app can call place_order directly; a command opens its root first, with neolith.command_scope("shop"). A test runs every Python block on this page under these settings.

Roadmap

The steps to 0.1 are in the roadmap.

Licensed under the BSD 3-Clause License.

Metadata

Release files for django-neolith 0.1.0a1

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

Source distribution (sdist)

Source distribution for django-neolith 0.1.0a1
File Size Uploaded Provenance Actions
django_neolith-0.1.0a1.tar.gz 553.1 kB With provenance Details for django_neolith-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-neolith 0.1.0a1
File Interpreter ABI Platform Actions
django_neolith-0.1.0a1-py3-none-any.whl Python 3 none any Details for django_neolith-0.1.0a1-py3-none-any.whl

Total release size: 658.9 kB

Release files / django_neolith-0.1.0a1.tar.gz

Download URL django_neolith-0.1.0a1.tar.gz
Size 553.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1ea1e5d894b9385c631ed7bff2dbd7c0757454dd656feb12d214814b3a732c82
BLAKE2b-256 checksum
How to use checksums
de105c92dd026c05c1f2bc66b17dbf40a832483a6e1b9ade449bccd7b1b905f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Release files / django_neolith-0.1.0a1-py3-none-any.whl

Download URL django_neolith-0.1.0a1-py3-none-any.whl
Size 105.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5e759aefcd72700d451eae952ad70f6128399ec854bdc1cf4e2d75c35086613
BLAKE2b-256 checksum
How to use checksums
29c8563716a5ed33616e6a55c4ccd81dc24a27b5174a1c191279988203f6d82e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 18, 2026.

Transparency log

Security for django-neolith 0.1.0a1

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 django_neolith-0.1.0a1.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 18, 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