django-utils
Shared Django utilities for Volkanos services — abstract base models and managers, DRF API helpers (request parsing, filtering, pagination, v1/v2 error handling), admin base classes, text and translation tools, and worker command helpers.
Installation
pip install entirius-django-utils
Add the app to your project:
INSTALLED_APPS = [
...
"django_utils",
]
Toolbox client
django_utils.toolbox talks to the Entirius AI Toolbox (completion proxy + model catalogue). Configure it in
the service settings; with any of the three empty, the client raises ToolboxNotConfiguredError and
status() returns unconfigured without touching the network.
AI_TOOLBOX_BASE_URL = "https://ai-toolbox.internal:8000"
AI_TOOLBOX_API_KEY = env("AI_TOOLBOX_API_KEY")
AI_TOOLBOX_CHANNEL = "my-channel"
from django_utils.toolbox import CompletionRequest, Message, ToolboxClient, ToolboxError, handle_toolbox_error
try:
with ToolboxClient() as client:
response = client.complete(
CompletionRequest(
model="fake-chat",
messages=[Message(role="user", content="Say hi as JSON")],
json_schema={"type": "object"},
tags=["leads.draft"],
)
)
except ToolboxError as exc:
return handle_toolbox_error(exc) # DRF Response: 402/403/404/400/422/503/504 or a generic 502
complete() makes exactly one HTTP attempt — it is paid and non-idempotent, retrying is the caller's
decision. list_models() retries on 5xx with backoff. Store responses with model_dump(mode="json")
(cost is a Decimal). In tests, django_utils.toolbox.testing.mock_toolbox() (needs the test extra)
mocks both endpoints with canned answers; error_response(402, "BUDGET_EXCEEDED") builds error bodies.
Full reference — settings, retries, error mapping: docs/toolbox-client.md.
Development
make install # sync dependencies (uv)
make check # lint + format check (ruff)
make test # test suite (pytest + pytest-django)
Development and agent instructions: AGENTS.md.
License
Mozilla Public License 2.0 — see LICENSE.
Metadata
Release files for entirius-django-utils 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entirius_django_utils-2.2.0.tar.gz | 87.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| entirius_django_utils-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 129.0 kB
Release files / entirius_django_utils-2.2.0.tar.gz
| Download URL | entirius_django_utils-2.2.0.tar.gz |
|---|---|
| Size | 87.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77d2b8f2b0f6dab687a62aa1e856fe269e389da6c9460d35cadfbec7e29f3cef
|
|
BLAKE2b-256 checksum How to use checksums |
1de39329ba03c6a8d2f0d46da2f1ecebaaf9bb716b64bb00359bb830772cc97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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}
|
Release files / entirius_django_utils-2.2.0-py3-none-any.whl
| Download URL | entirius_django_utils-2.2.0-py3-none-any.whl |
|---|---|
| Size | 41.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
728039494fac0940f7fbc7c77f3736dac80e56c24f79ac3c50ebc394beaff6ef
|
|
BLAKE2b-256 checksum How to use checksums |
b7a3b808f760630020c7270dd3ab16c3a15adea25edb2efc8bfe6ae07321801a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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}
|