Skip to main content

Dogwood Policy Python SDK

Python SDK and PyO3 binding for the Dogwood policy language. Dogwood supports fine-grained authorization decisions that depend on history or patterns of events over time, then lowers policies back to Cedar for evaluation.

For full documentation, see dogwood-py.abhishek-tiwari.com.

⚠️⚠️⚠️ Current Dogwood reference interpreter is not intended for production use; therefore, this Python SDK and PyO3 binding is experimental in nature.

Note: This is an unofficial Python SDK and port for Dogwood Policy. Support is provided on a best effort basis with community help.

GitHub Release GitHub Actions Test Workflow Status PyPI - Version Python Wheels Python Versions GitHub last commit PyPI - Status Conda Version License GitHub Downloads (all assets, all releases) PyPI Downloads

Install

pip install dogwood-py

Optional extras:

pip install "dogwood-py[examples]"        # FastAPI and general examples
pip install "dogwood-py[strands]"         # Strands integration and shopping-agent example
pip install "dogwood-py[examples,strands]"

The package installs as dogwood:

from dogwood import native

assert native.available()

What It Provides

The public API follows the Rust dogwood-language lifecycle:

  1. Build a ServiceSchema and PolicySchema.
  2. Parse and lower policy source into a LoweredPolicySet.
  3. Validate it.
  4. Feed Event values to a stateful Authorizer.

The native path uses PyO3/maturin to call the Rust Dogwood reference implementation for schema-backed lowering, validation, trace replay, augmented Cedar schema export, and authorization. A temporary pure-Python fallback remains only for limited schema-less examples.

The Python SDK includes a PolicyEnforcer wrapper with mode="enforce" and mode="log_only" for rollout and audit behavior. Dogwood still evaluates the policy; the SDK mode controls whether a denied decision blocks the operation or is reported as would_have_denied.

dogwood-py also provides optional Strands Agents support. Dogwood policies can be attached as Strands interventions so tool calls are checked before execution, with typed outcomes such as proceed, deny, guide, confirm, and transform.

Strands integrations use the same SDK-level enforce and log_only modes on top of the Rust Dogwood policy decision.

Documentation

Dogwood language documentation is available at dogwood-policy.github.io/dogwood.

Examples

Checked-in examples are documented at Examples. After installing the package and optional dependencies, run examples directly:

python -m examples.api_usage

python -m examples.cli

python -m uvicorn examples.fastapi_simple.app:app --host 127.0.0.1 --port 8000

python -m examples.strands_shopping_agent.agent --user alice

Development

make setup
make develop
make test
make docs
make build

Useful targets:

  • make docs-ci installs docs-only dependencies and builds Sphinx HTML docs.
  • make docs-watch serves live-reloading docs at http://127.0.0.1:8001.
  • make perf-test runs the opt-in native-vs-Python replay regression check.

The docs-only Cloudflare Pages build command is:

make docs-ci PYTHON=python

Build output directory:

docs/build/html

Current Scope

Rust-backed operations cover schema-backed lowering, validation, authorization, and trace replay. The Python fallback is temporary and schema-less only. The intended end state is to remove it once the Rust-backed SDK objects cover the same ergonomic surface.

Metadata

Release files for dogwood-py 0.0.10

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

Source distribution (sdist)

Source distribution for dogwood-py 0.0.10
File Size Uploaded
dogwood_py-0.0.10.tar.gz 42.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for dogwood-py 0.0.10
File
dogwood_py-0.0.10-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
dogwood_py-0.0.10-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
dogwood_py-0.0.10-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
dogwood_py-0.0.10-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
dogwood_py-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 28.5 MB

Release files / dogwood_py-0.0.10.tar.gz

Download URL dogwood_py-0.0.10.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ba1e48c0c2b88d3972a6a05a3c29b7a3d9d06777f1f86f9858bf972032a194b7
BLAKE2b-256 checksum
How to use checksums
05eda0be2e608d6cfd615521e130db8eb5acbef1f345f77aa9c9c040aa9d04b1
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 Aug 29, 2026.

Transparency log

Release files / dogwood_py-0.0.10-cp310-abi3-win_amd64.whl

Download URL dogwood_py-0.0.10-cp310-abi3-win_amd64.whl
Size 5.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a8edefb32177c0a962305888296091a2b9987235a03a3bd818f70df199c77808
BLAKE2b-256 checksum
How to use checksums
c98a541f0118d564b1f251f773a2955a812a22663e59983c8f2a2da32388c941
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 Aug 29, 2026.

Transparency log

Release files / dogwood_py-0.0.10-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dogwood_py-0.0.10-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fa41b6d0a879a7137dceb38fdcb31da9773bc7e8ef87bc6b58c6c002213cabdd
BLAKE2b-256 checksum
How to use checksums
38882e423f246642a982761d3ca1d9e35b032ac8a60d51d31d2203421e3c2c8a
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 Aug 29, 2026.

Transparency log

Release files / dogwood_py-0.0.10-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL dogwood_py-0.0.10-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.0 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9315bbd68f5880e483abf57feacb486d14f5565950e490bb35c55f95c0d4ffa7
BLAKE2b-256 checksum
How to use checksums
ec33774f62c2d2d57f33d301235aa817efd7902a1547d1672666d9d33a237522
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 Aug 29, 2026.

Transparency log

Release files / dogwood_py-0.0.10-cp310-abi3-macosx_11_0_arm64.whl

Download URL dogwood_py-0.0.10-cp310-abi3-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
15e6f4506168b6a5db2daaaf5ad51e7404cb831d90b76dac127f25d1414eee68
BLAKE2b-256 checksum
How to use checksums
04fe0a85c36c416c3aa1acaf9ebf2b9b440c886d9d10b6941e60077b2aad3f56
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 Aug 29, 2026.

Transparency log

Release files / dogwood_py-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl

Download URL dogwood_py-0.0.10-cp310-abi3-macosx_10_12_x86_64.whl
Size 5.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4845e84b8fe04d248b8965845cce7461de395b99711d25630af4daee38d583f8
BLAKE2b-256 checksum
How to use checksums
b51ced1c9fe42d8db335af17b2f54dfe81b03b04571fb4b9c710d6475fbc7abf
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 Aug 29, 2026.

Transparency log
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