skillfed

cedarpy

cedarpy v4.8.7 669.6K downloads/30d#5,412 on PyPI
License unclear Active released

What it is and what it does

cedarpy is a Python wrapper around the Cedar Policy authorization engine, a Rust-based policy evaluator developed by AWS. It lets you define fine-grained access-control policies in Cedar's domain-specific language, then evaluate authorization requests against those policies and a schema from Python. The package supports three main workflows: checking whether a single request is authorized, validating policies against a schema, and formatting policies.

The library is designed for performance in long-running services and serverless functions. It offers batch authorization (evaluating many requests against shared policies in one call, often 10x faster than individual calls), reusable PolicySet handles to avoid re-parsing static policies on every request, and optional per-request policy fragments layered on top of a static base. It has no runtime dependencies and is available as pre-built wheels for modern Python versions and common platforms.

Use it for:

  • Enforce fine-grained access control in a web service by evaluating Cedar policies against incoming requests before granting access to resources.
  • Batch-authorize a set of user actions in a single call to avoid the overhead of parsing policies and entities repeatedly.
  • Validate a policy file against a schema at deployment time to catch syntax and type errors before policies go live.
  • Reuse a static policy set across many authorization requests in a long-running service or Lambda function, avoiding repeated parsing.
  • Add dynamic per-request policies to a static base policy set without re-parsing the entire base each time.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

cedarpy binds the Cedar Policy authorization engine to Python, letting you evaluate access-control policies and validate them against schemas from Python code.

Yes, if you need Cedar's policy language and evaluation engine in Python. The package is actively maintained, has no known vulnerabilities, covers modern Python versions and common platforms with pre-built wheels, and offers both single-request and batch authorization with performance optimizations for static policies. License treatment is unclear, so verify licensing terms before use in commercial projects.

Install

cedarpy on PyPI

pip

pip install cedarpy

uv

uv add cedarpy

poetry

poetry add cedarpy

Installing cedarpy

Before you install

Medium install friction due to platform-specific wheels (compiled Rust bindings), but pre-built wheels cover Linux x86_64/aarch64, macOS x86_64/arm64, and Windows x86_64 for Python 3.10–3.14. Active maintenance with a release 35 days ago.

Quickstart

pip install cedarpy

from cedarpy import is_authorized, Decision

policies = "permit(principal, action, resource);"
entities = [{"uid": {"__entity": {"type": "User", "id": "alice"}}, "attrs": {}, "parents": []}]
request = {"principal": 'User::"alice"', "action": 'Action::"read"', "resource": 'Photo::"1"', "context": {}}

result = is_authorized(request, policies, entities)
if result.decision == Decision.Allow:
    print("Access granted")

Requires Python 3.9 or later; pre-built wheels available for Linux, macOS, and Windows on common architectures.

Verify before relying

  • Whether the package is officially supported by AWS or the Cedar Policy team (description states it is not, but maintainer affiliation is unclear)
  • Exact performance characteristics of batch authorization relative to single-request calls in real-world scenarios

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 35 days since the last release
First released
Downloads 669,604/month — #5,412 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cedarpy-4.8.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cedarpy-4.8.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cedarpy-4.8.7-cp310-cp310-win_amd64.whl; cedarpy-4.8.7-cp311-cp311-macosx_10_12_x86_64.whl; cedarpy-4.8.7-cp311-cp311-macosx_11_0_arm64.whl; cedarpy-4.8.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cedarpy-4.8.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cedarpy-4.8.7-cp311-cp311-win_amd64.whl; cedarpy-4.8.7-cp312-cp312-macosx_10_12_x86_64.whl; cedarpy-4.8.7-cp312-cp312-macosx_11_0_arm64.whl; cedarpy-4.8.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cedarpy-4.8.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cedarpy-4.8.7-cp312-cp312-win_amd64.whl; cedarpy-4.8.7-cp313-cp313-macosx_10_12_x86_64.whl; cedarpy-4.8.7-cp313-cp313-macosx_11_0_arm64.whl; cedarpy-4.8.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cedarpy-4.8.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cedarpy-4.8.7-cp313-cp313-win_amd64.whl; cedarpy-4.8.7-cp314-cp314-macosx_10_12_x86_64.whl; cedarpy-4.8.7-cp314-cp314-macosx_11_0_arm64.whl

Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust

Tags

cedar policy authorization pythonaccess control policy engineauthorization decision evaluationpolicy validation schemaattribute-based access controlpython policy enginecedar rust bindings
authorizationaccess-controlpolicy-engine

More Security packages