
Python SDK for Permit.io: Plug & Play Application Level Authorization
Repo permitio/permit-python, read from GitHub 5 h ago. permitio has not joined Take My Repo.
log.level and log.label are now applied. Every SDK log record goes through the SDK's logger, which replaces the API key of every client in the process with [REDACTED], as given and in lower case.PermitConnectionError carries a plain aiohttp.ClientError in its place.With log={"enable": True} and nothing else, the defaults now apply:
info).[Permit] .Set level="debug" or label="" to keep the old output.
Full Changelog: v3.0.0...v3.0.1
permit 3.0.0 is a major release. It requires Python 3.10 or later and raises dependency floors to clear known advisories. It also fixes SDK bugs, ships type information and supports Python 3.14.
Before you upgrade, read the migration guide. Each change below has an ID there (for example C1 or A2), with who is affected, what to do, and a before/after example.
Upgrade with an AI agent. The permit-python-3-migration skill takes an agent such as Claude Code through the guide:
To install it, download permit-python-3-migration.skill below and unzip it into .claude/skills/, or copy skills/permit-python-3-migration. Its scanner is read-only and runs on Python 3.8+:
python3 .claude/skills/permit-python-3-migration/scripts/scan.py .Compatibility
Python 3.10 or later (C1). aiohttp 3.14.3 requires it, and it is the only release that fixes CVE-2026-69244. On Python 3.9, pip install -U permit keeps your current version without an error.
httpx is no longer installed with permit (C2). The packages that came only through it are gone too: h11, httpcore, anyio, certifi, and with some versions sniffio and exceptiongroup. zipp is also gone. permit never imported any of them, so declare the ones your code uses.
Higher dependency floors (C3):
| Package | Python | 3.0.0 requires |
|---|---|---|
| pydantic | 3.10–3.12 | >=1.10.18,<2 or >=2.4.2 |
| pydantic | 3.13 | >=1.10.18,<2 or >=2.8.0 |
| pydantic | 3.14 | >=1.10.25,<2 or >=2.13 |
| aiohttp | all | >=3.14.3,<4 |
| typing-extensions | all | >=4.14.0,<5 |
| loguru | all | >=0.7.3,<1 |
permit ships type information (T1–T3, PEP 561 py.typed).
ignore_missing_imports or # type: ignore[import-untyped] for permit..model_dump() on them are now type errors; they already failed at runtime.API
resource_relations.list() returns PaginatedResultRelationRead (A1). Read .data. In 2.x every call raised ValidationError.permit.sync.Permit, authorized_users(), get_user_permissions() and filter_objects() are synchronous (A2). Drop the await.
RuntimeError: This event loop is already running.permit.Permit is unchanged.ContextStore.register_transform(), ContextStore.transform() and ContextTransform. A registered transform was never applied.ApiKeyLevel. Use ApiKeyAccessLevel.LoginAsErrorMessages, OpaResult and JWT.permit.PYDANTIC_VERSION, and the same name in permit.api.models and permit.pdp_api.base.pdp_config_id on AuditLogModel and DetailedAuditLogModel is Optional[UUID].DetailedAuditLogModel.objects is optional.Engine.GENERIC and GenericEngineDecisionLog.object_id on RelationshipTupleRead and RelationshipTupleDetailedRead is Optional[UUID].*_details fields on RelationshipTupleDetailedRead are optional.APIKeyOwnerType gains nats_pdp_config.relationship_tuples.list() and create() raised on a tuple with no object_id, and environments.get_api_key() raised on a key owned by nats_pdp_config.Wire behaviour (same API, different request bytes)
None is sent as null (W1), so an update can clear a field. In 2.x, users.update(key, UserUpdate(email=None)) sent {}. Fields you never set are still omitted.users.assign_role() and unassign_role() omit unset fields (W2), like role_assignments.assign().elements.login_as() sends hyphenated UUIDs (W3). The API accepts both forms.Authorization header uses Bearer (W5), not bearer. This fixes the 401 from Cloud PDP (#122).permit.api.assign_role() and unassign_role() call /users/{user}/roles (W6), through permit.api.users, instead of /role_assignments. The effect is the same.PermitConnectionError still subclasses PermitException, so except PermitException still catches connection failures.
permit 4.0, a future major release, will remove the following. They work in 3.x. Each raises a DeprecationWarning that names the replacement, reported at the line that made the call.
import permit warns once.permit.api (D2). For example, permit.api.get_user() becomes permit.api.users.get(). The guide maps all 21.To find every deprecated call your tests reach:
python -m pytest -W error::DeprecationWarning -W "ignore:Use PermitError instead:DeprecationWarning"The second filter is needed in 2.x too: import permit warns because PermitConnectionError subclasses the deprecated PermitException.
| Package | 2.8.3 allowed | 3.0.0 | Fixes |
|---|---|---|---|
| aiohttp | >=3.12.14 |
>=3.14.3 |
32 advisories, including CVE-2026-69244 (out-of-bounds read in the HTTP response parser) |
| pydantic | >=1.10.7 |
see above | CVE-2024-3772 (ReDoS in EmailStr validation) |
| httpx | >=0.24.1 |
removed | Removes h11 (CVE-2025-43859) and anyio (CVE-2026-63374) from your dependency tree |
| zipp | >=3.19.1 |
removed | Unused |
If you are staying on 2.x for now, see the guide's "Staying on 2.x for now". It lists constraints that clear these advisories on Python 3.10+, and the advisories' workarounds for 3.8 and 3.9.
permit.sync.Permit, the flat permit.api methods sent their request and then raised ValueError: a coroutine was expected. A write took effect while the caller got an error. They now return the result, so remove any except ValueError around them.authorized_users() failed under pydantic 2.bulk_check() ignored a per-check context, and filter_objects() dropped your context. So ABAC checks that depend on context were evaluated against an empty one.UserInput silently dropped first_name and last_name from every check.datetime, UUID or Enum in a dict or list request body crashed inside aiohttp.PermitConnectionError now carries the status code and response body. Code that matches the old message needs updating.proxy_facts_via_pdp, tenants.bulk_create() and tenants.bulk_delete() went to the PDP's users endpoint.permit.pdp_api.* calls ignored pdp_timeout, and the sync pdp_api client didn't initialize correctly.users.sync(). It removed key from the dict you passed, so that path always returned 422.resource_instances.list(detailed_key=...). It raised TypeError.import permit crashed on pre-releases such as 2.14.0b2.tests package into site-packages, where it could shadow your own.Python 3.14 is supported and tested (#124). The floors above keep resolvers off releases that crash or warn on 3.14. import permit no longer emits 21 DeprecationWarnings there.
mypy --strict and pyright:
str is accepted for EmailStr fields;UserInput accepts both field spellings;PermitConfig() without a token is a type error, as it already was at runtime.pydantic.v1.mypy (T3).Thanks to @SureneruS for the Bearer report and fix (#122, #123), to @Tarcio0211 for the py.typed marker (#125), and to @coactive-jeffrey (#116) and @jameswu1991 (#124) for their reports. #123 and #125 shipped as part of #126.
Full changelog: v2.8.3...v3.0.0
Full Changelog: 2.8.2...2.8.3
Full Changelog: 2.8.1...2.8.2