Skip to main content

z4j domain core - models, protocols, transport, redaction, policy (Apache 2.0)

Project description

z4j-core

PyPI version Python License

License: Apache 2.0 Status: v1.0.0 — first public release.

The pure domain core of z4j. Imports nothing framework- or engine-specific — only Pydantic and the Python standard library. This is enforced by import-linter in CI. Any PR that tries to import Django, Celery, Redis, SQLAlchemy, FastAPI, etc. from z4j_core will fail the build.

Install

pip install z4j-core

You will rarely need to install z4j-core directly — every z4j agent and the brain server depend on it and pull it in automatically.

Why this matters

Every other package in the z4j project depends on z4j-core. The brain uses its domain models and wire protocol; every adapter implements one of its Protocols. Keeping this package free of framework coupling is what lets us:

  1. Ship v1 with Django + Celery, then add Flask / FastAPI / RQ / Dramatiq / Huey / arq / taskiq as peer packages without touching the core.
  2. Test the entire domain layer with no database, no broker, no HTTP.
  3. Evolve the protocol without rewriting the dashboard or the brain.
  4. Let contributors add a new engine adapter over a weekend without understanding any of the rest of the system.

What's in here

Module Purpose
z4j_core.models Pydantic v2 domain models (Project, Agent, Task, Queue, Worker, Schedule, Command, Event, AuditEntry, User, Config, ...)
z4j_core.protocols QueueEngineAdapter, FrameworkAdapter, SchedulerAdapter — the three adapter interfaces adapters implement
z4j_core.errors Exception hierarchy (Z4JError, ValidationError, AuthenticationError, ...)
z4j_core.redaction Secret redaction engine with default patterns and per-field overrides
z4j_core.transport Wire protocol — frame shapes, version negotiation, HMAC v2 signing
z4j_core.policy Permission engine — can(user, action, project)

Documentation

  • Architecture — full system architecture and Protocol signatures
  • API — REST API and WebSocket agent protocol
  • Security — threat model, redaction, HMAC
  • Adapter guide — how to build a third-party adapter against these Protocols

Development

git clone https://github.com/z4jdev/z4j-core.git
cd z4j-core
uv sync --all-extras --dev
uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest -xvs tests/
uv run lint-imports            # enforces core-purity contract

License

Apache 2.0. See LICENSE. This package is deliberately permissively licensed so that proprietary Django / Flask / FastAPI applications can import it without any license concerns.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

z4j_core-1.0.0.tar.gz (65.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

z4j_core-1.0.0-py3-none-any.whl (66.3 kB view details)

Uploaded Python 3

File details

Details for the file z4j_core-1.0.0.tar.gz.

File metadata

  • Download URL: z4j_core-1.0.0.tar.gz
  • Upload date:
  • Size: 65.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for z4j_core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3ccf2e37f1d2d957b69c49cc156d98cf398bc515354d3474a64079b9759e0c11
MD5 f7b5ae45564eb701956243aeda5dec63
BLAKE2b-256 26366855f9bddc49d082e3eb63ffd3918ead51df7d85272b92b8337ed1ab92fe

See more details on using hashes here.

File details

Details for the file z4j_core-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: z4j_core-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 66.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for z4j_core-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 357bf6bb9d911f70777cf73c2cae26ddd8ae55b09611e822e0adfbbdf7791f6b
MD5 158a0c854a17045aa53163d96b3e8220
BLAKE2b-256 f05fa1f3391c771776b69e65c50d3d3f77f63943f7d01e32be1cf67e709795d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page