modwire-hex
Explicit dependency-injection conventions for hexagonal Django applications, built on Wireup.
Install
pip install modwire-hex
The framework keeps the container at the composition root. Domain and application code use ordinary, type-annotated constructor dependencies.
Domain code may use DomainError for business-rule failures. It must not
contain HTTP status codes, response shapes, Django types, or DI concerns.
from modwire_hex import DomainError
class OrderCannotRequestCredit(DomainError):
pass
from modwire_hex import Containers, Module, Providers
class Payments:
def charge(self, amount: int) -> None: ...
class StripePayments(Payments):
def charge(self, amount: int) -> None:
...
class PlaceOrder:
def __init__(self, payments: Payments) -> None:
self.payments = payments
orders = Module(
"orders",
providers=[
Providers.service(PlaceOrder, None),
Providers.bind(Payments, StripePayments, "singleton", None),
],
)
container = Containers.create_sync((orders,), None)
with container.enter_scope() as scope:
place_order = scope.get(PlaceOrder)
See ADR 0001 for the architecture, conventions, and delivery sequence.
Django integration
Compose a Django process through one explicit application object:
from modwire_hex import DjangoApplication
from .orders.wiring import orders
application = DjangoApplication(modules=(orders,))
Configure the framework and its Ninja Extra API in Django settings:
INSTALLED_APPS = [
"modwire_hex.django.apps.ModwireConfig",
]
MIDDLEWARE = [
"modwire_hex.django.middleware.RequestScopeMiddleware",
]
MODWIRE = {
"APPLICATION": "myproject.wiring:application",
"NINJA": {"title": "My Project API", "version": "1.0.0"},
}
Mount the framework API once. Ninja Extra discovers controllers from installed HTTP adapter apps:
from django.urls import path
from modwire_hex.django import DjangoNinja
urlpatterns = [path("api/", DjangoNinja.api().urls)]
At an HTTP boundary, resolve only use cases from the active request scope:
from modwire_hex.django import DjangoRequest
place_order = DjangoRequest.resolve(request, PlaceOrder)
DjangoRepository is a base for outbound adapters. It centralizes generic
load and create-or-update persistence mechanics; each context repository owns
its key, lookup, record mapping, and absence semantics.
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 modwire_hex-0.1.0.tar.gz.
File metadata
- Download URL: modwire_hex-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4e33a8f557916aa69dd8cef6da70fd1b4991cf680d6670cd816435917510b90
|
|
| MD5 |
300bf4578afde43f96a4b2470716f86b
|
|
| BLAKE2b-256 |
8533e172d21bab326d2f47d8c78aca4025541c655d2d42a6cab6a089e49aff1a
|
Provenance
The following attestation bundles were made for modwire_hex-0.1.0.tar.gz:
Publisher:
release.yml on modwire/modwire-hex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modwire_hex-0.1.0.tar.gz -
Subject digest:
d4e33a8f557916aa69dd8cef6da70fd1b4991cf680d6670cd816435917510b90 - Sigstore transparency entry: 2195773957
- Sigstore integration time:
-
Permalink:
modwire/modwire-hex@e96498373c84c789ffadc259f0ba12a40474025c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/modwire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e96498373c84c789ffadc259f0ba12a40474025c -
Trigger Event:
release
-
Statement type:
File details
Details for the file modwire_hex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: modwire_hex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 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 |
fb39787c2ca606a6f4dc3d9488370a3b3405787e848424417c5c3cbdebb84e74
|
|
| MD5 |
bd87ed2929661edcd0715904c5aa835c
|
|
| BLAKE2b-256 |
7f0d81a1ec56d941ce65f934d6c7ee66c72012a0f4ddcc5a4497f3f046da0330
|
Provenance
The following attestation bundles were made for modwire_hex-0.1.0-py3-none-any.whl:
Publisher:
release.yml on modwire/modwire-hex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modwire_hex-0.1.0-py3-none-any.whl -
Subject digest:
fb39787c2ca606a6f4dc3d9488370a3b3405787e848424417c5c3cbdebb84e74 - Sigstore transparency entry: 2195774029
- Sigstore integration time:
-
Permalink:
modwire/modwire-hex@e96498373c84c789ffadc259f0ba12a40474025c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/modwire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e96498373c84c789ffadc259f0ba12a40474025c -
Trigger Event:
release
-
Statement type: