Skip to main content

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.1.0

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

Source distribution (sdist)

Source distribution for entirius-django-utils 2.1.0
File Size Uploaded
entirius_django_utils-2.1.0.tar.gz 85.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for entirius-django-utils 2.1.0
File Interpreter ABI Platform
entirius_django_utils-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 125.8 kB

Release files / entirius_django_utils-2.1.0.tar.gz

Download URL entirius_django_utils-2.1.0.tar.gz
Size 85.8 kB
Tags Source
SHA-256 checksum
How to use checksums
24f1cb35368a5c5e02fc0037f8b7aa18ef80dedbad3c61b0154f650e1b30b18a
BLAKE2b-256 checksum
How to use checksums
35eeec2780bee626e2b97055904d4a163f7b75219bd037d0aba9703c92bac718
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.1.0-py3-none-any.whl

Download URL entirius_django_utils-2.1.0-py3-none-any.whl
Size 40.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5080a99d67c9b5ac449dc6bd692d67103909944e29809880b95183641a965c0
BLAKE2b-256 checksum
How to use checksums
2dab39d505b1cfb5fa70efccae54731c6068b124b95d6696245056c59d5484d5
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 history Release notifications | RSS feed

2.3.0

2 release files

2.2.0

2 release files

This release

2.1.0 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

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