Registry / aws / cedarpy

cedarpy

JSON →
library4.8.1pypypi✓ verified 82d ago

A Python binding for Cedar (AWS's policy language), enabling policy evaluation and management. Current version 4.8.1 requires Python >=3.9. Active development, monthly releases.

pip install cedarpy
INSTALL
IMPORT
SIG · CEDARPY
C
cedarpy
awspythonv4.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

is_authorized
from cedarpy import is_authorized
from cedarpy import CedarPolicy
AuthzResult
from cedarpy import AuthzResult
PolicySet
from cedarpy import PolicySet

Load a simple Cedar policy, create entities, and evaluate an authorization request.

from cedarpy import CedarPolicy, CedarEntity policy = CedarPolicy('permit(principal in Namespace::"User::"+resource.owner, action, resource);') entities = [CedarEntity(uid='User::"alice"', attrs={'owner': 'alice'})] request = policy.evaluate(principal='User::"alice"', action='Action::"view"', resource='Resource::"file1"', entities=entities) print(request.decision)
Debug
Known issues
breakingIn version 4.x, the API changed significantly from 3.x. The `evaluate` method now returns an object with a `decision` attribute instead of a string.
fix
Ensure your code accesses `.decision` on the result object, e.g., `result.decision`.
affects: >=4.0.0
deprecatedThe `CedarPolicy.from_string()` method is deprecated in favor of the constructor `CedarPolicy(...)`.
fix
Replace `CedarPolicy.from_string(policy_str)` with `CedarPolicy(policy_str)`.
affects: >=4.5.0
gotchaEntity UIDs must include the type prefix (e.g., 'User::"alice"'). Omitting the type will cause evaluation to fail silently or return Deny.
fix
Always specify the entity type in the UID string, like `'User::"alice"'`.
affects: >=4.0.0
Upgrade
Version history
4.8.1latest on PyPI · released Apr 23, 2026
Audit
Dependencies
pydanticrequiredUsed for validation and serialization of Cedar entities and requests.
Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
cedarpy — pip install cedarpy · libregistry