Skip to main content

pytrat-policy

Policy-as-code for PyTraT (OAuth Transaction Tokens): a strict YAML policy model, its compiler, and TransactionEnforcer, the framework-agnostic per-request pipeline (one Txn-Token → verify → authenticate the caller → evaluate policy → one audit event) that the FastAPI and Django integrations share.

pip install pytrat-policy

A policy

version: 1
trust_domain: payments.internal
resources:
  - name: ledger-entry
    method: POST
    path: /internal/ledger/entries
    allowed_scopes: [payments.transfer]
    allowed_callers: [payment-service]
    bind_context: [source_account, destination_account, amount_minor, currency]
from pytrat.policy import load_policy

policy_set = load_policy("policy.yaml", expected_trust_domain="payments.internal")
policy = policy_set.for_route("POST", "/internal/ledger/entries")  # unknown routes: deny

Unknown keys, duplicate keys, wrong types and settings that would be silently ignored are all rejected at load time. Routes without a policy are denied (POLICY_NOT_FOUND). Checks run in a fixed order (scope, caller, binding, agent constraints, replay), so audit reasons are stable.

Documentation

PyTraT documentation: Policies (full schema reference) and the pytrat.policy API reference (sources in docs/ of the repository).

Apache-2.0.

Metadata

Release files for pytrat-policy 0.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 pytrat-policy 0.1.0
File Size Uploaded Provenance Actions
pytrat_policy-0.1.0.tar.gz 31.6 kB Without provenance Details for pytrat_policy-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytrat-policy 0.1.0
File Interpreter ABI Platform Actions
pytrat_policy-0.1.0-py3-none-any.whl Python 3 none any Details for pytrat_policy-0.1.0-py3-none-any.whl

Total release size: 55.6 kB

Release files / pytrat_policy-0.1.0.tar.gz

Download URL pytrat_policy-0.1.0.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
078ebd48c9c7f290b56efc768257410e327d1f98469dd0c8857ae7acf627bcda
BLAKE2b-256 checksum
How to use checksums
1deb13670aa9b723b3b00978a89d33855361a2ccc81bad29de038cade52e013f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pytrat_policy-0.1.0-py3-none-any.whl

Download URL pytrat_policy-0.1.0-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbf75797cf6ba032d14c48df00acc57a54649b35327b57d554544be4d7bd53ec
BLAKE2b-256 checksum
How to use checksums
3c4ddca400e8fb1ad15d9279b962cebd5531c34ae10073c2cc12914b6d112bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pytrat-policy 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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