# apache/casbin-pycasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Python

Repository: https://github.com/apache/casbin-pycasbin
Canonical: https://ross.abutalabs.com/products/casbin-pycasbin
Homepage: https://casbin.org
Language: Python
License: Apache-2.0
License Family: permissive
Topics: casbin, python, pycasbin, access-control, authorization, rbac, abac, acl, auth, authz, permission
Last push: 2026-08-13T05:58:49+00:00

## Health v2 (maintenance only)
Score: 87/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 97, release rhythm 68, longevity 100
- inputs: {"age_days": 2904, "days_push": 20, "days_rel": 212, "gap_med": 8, "n_releases_24m": 24}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1764, forks 218 (observed 2026-08-28T04:05:32.977210+00:00)

## What it is
PyCasbin is the Python implementation of Apache Casbin, an authorization library that enforces access control via configurable models such as ACL, RBAC, and ABAC. Policies can be stored in files or databases through adapters, and the enforcer API evaluates requests against the model and policy.

## Use cases
- enforce role-based access control in a Python web app
- implement ABAC permission checks based on user attributes
- store authorization policies in MySQL or PostgreSQL
- manage role hierarchies and permissions in a Django or Flask application
- switch access control models without rewriting application code
- add multi-tenant authorization with filtered policy loading

## When to choose
- you need flexible, model-driven authorization (ACL/RBAC/ABAC) in Python
- you want policies persisted in a database via adapters
- you need cross-language consistent authorization semantics

## When to avoid
- you only need simple hardcoded role checks with no policy files
- you need authentication (login/identity) rather than authorization
- your stack is not Python - use the Casbin implementation for your language

## Facets
- artifact type: library
- maturity: stable
- function: authorization, auth, middleware
- domain: security, backend, web-development, developer-tools
- platform: python, cross-platform
- tags: rbac, abac, acl, access-control, casbin, policy-enforcement

## Member repositories
- apache/casbin-pycasbin (main) score 87

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:32.977210+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:26:37.670172+00:00, confidence not recorded.
  - readme: https://github.com/apache/casbin-pycasbin (fetched 2026-08-28T04:05:32.977210+00:00, sha 3d7c510570bc)
  - homepage: https://casbin.org (fetched 2026-08-29T11:05:07.385616+00:00, sha bf9a21b944e9)
  - site_page: https://casbin.apache.org/docs/overview (fetched 2026-08-29T11:05:07.394772+00:00, sha e6df9330fc66)
  - site_page: https://casbin.apache.org/docs/downloads (fetched 2026-08-29T11:05:07.397139+00:00, sha 34577d2c2ff2)
  - site_page: https://casbin.apache.org/docs/get-started (fetched 2026-08-29T11:05:07.398677+00:00, sha 1cef184398ca)
  - site_page: https://casbin.apache.org/docs/category/access-control-models (fetched 2026-08-29T11:05:07.400512+00:00, sha 323b2c9c0a23)
  - site_page: https://casbin.apache.org/docs/category/storage (fetched 2026-08-29T11:05:07.401911+00:00, sha 36570671a14a)
  - site_page: https://casbin.apache.org/docs/adapters (fetched 2026-08-29T11:05:07.403410+00:00, sha cd140120068d)
  - site_page: https://casbin.apache.org/docs/category/api (fetched 2026-08-29T11:05:07.405484+00:00, sha 4099ba1bb75f)
  - site_page: https://casbin.apache.org/docs/ide-plugins (fetched 2026-08-29T11:05:07.407035+00:00, sha 5a9e92f4f45a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
