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.

Download files

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

Source Distribution

decern-0.3.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

decern-0.3.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file decern-0.3.0.tar.gz.

File metadata

  • Download URL: decern-0.3.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for decern-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1a56ce920be48f8665fbf8d8f5356950bb38fed003ad7175a21046e1ae6379a9
MD5 cfa94c0c544498e9911d2f1e65844543
BLAKE2b-256 fa85ccba8f1e918f2cf171e809f604efc44411d71bc8c6c9db66a8bca3a6120b

See more details on using hashes here.

Provenance

The following attestation bundles were made for decern-0.3.0.tar.gz:

Publisher: publish-sdks.yml on anivar/decern

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file decern-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: decern-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for decern-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8d9bee474c0323d8e87a7c5be5cb6add5bb656cbd0d2c49428f0f53f8d4744b
MD5 1bcf34fe0f2e76f764d3a8064a099c89
BLAKE2b-256 1eb692c0e05ae79f66ad80d91f01ab93bbff6fcb0f64f52571c784faba79ee63

See more details on using hashes here.

Provenance

The following attestation bundles were made for decern-0.3.0-py3-none-any.whl:

Publisher: publish-sdks.yml on anivar/decern

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.1

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.1

2 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