Skip to main content

decern — Python client

PyPI License DOI

Website · Repository · Commands · Issues

Ask whether an action is allowed, and get an answer somebody can check afterwards. Standard library only — no requests, no httpx. Python ≥ 3.11.

uv add decern
# and a server to ask:
cargo install decern-server && decern-serve --trust-proxy
from decern import Client

c = Client("http://127.0.0.1:8080")  # optionally: token="…"

d = c.evaluate(
    subject={"type": "Principal", "id": "corp"},
    action="Read",  # or {"name": "Read"}
    resource={"type": "Resource", "id": "claim1"},
)

d.allowed   # True / False
d.reasons   # the policies that decided it, on allow
d.errors    # why not, on deny

When token is set it is sent as Authorization: Bearer on every request, for a deployment that requires bearer tokens on the evaluation endpoint.

Also on the client: c.pubkey() (the Ed25519 key id the log is signed with) and c.healthy(). A non-2xx response or transport failure raises DecernError with the HTTP status and body, so a denial is distinguishable from a misconfigured endpoint. context is advisory — the server overrides anything it derives itself (the clock, the accountable owner), so a caller cannot talk its way into a decision by supplying them.

What the server gives you

decern is an AuthZEN 1.0 authorization server whose safety rules are machine-checked over every input, and whose decisions land in an append-only, signed, hash-chained log before they are served — a decision that cannot be recorded is refused, and a third party can verify what was decided without trusting the operator:

decern verify --ledger <file> --pubkey <key>   # the chain and every signature
decern explain --ledger <file> --seq 12        # one decision, in full

Obtain the public key out of band; a key handed over by the party being audited establishes nothing.

Test

cd sdks/python && python -m unittest discover -v

Apache-2.0. Published from CI by OIDC with no stored credential.

Metadata

Release files for decern 0.4.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 decern 0.4.0
File Size Uploaded
decern-0.4.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for decern 0.4.0
File Interpreter ABI Platform
decern-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / decern-0.4.0.tar.gz

Download URL decern-0.4.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7f647fba2fc15aa4082ee4203c0ffb88a0f27a4c4130f85755c9652e5c7216cb
BLAKE2b-256 checksum
How to use checksums
51ea9075ee2cb0080fe634273ff35dd32104ef469444c1ad065f14de38f62e4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 9, 2026.

Transparency log

Release files / decern-0.4.0-py3-none-any.whl

Download URL decern-0.4.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
254f3c2f8961a627c31241aed78be6dee2568a2a755179d1a801706d0269db93
BLAKE2b-256 checksum
How to use checksums
8e4652c8178437a4133224989bc89093e03568657d5ed168634405d9ce3c4deb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

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