rest_condition
Complex permissions flow for django-rest-framework
What it is and what it does
rest_condition is a small utility library that adds boolean logic operators to permission systems. It provides And, Or, and Not operators to build complex permission expressions—for example, allowing access if (Perm1 AND Perm2) OR (NOT Perm2). The library wraps individual permission classes and composes them into a single permission that evaluates the full expression.
The package has no runtime dependencies. However, it has been abandoned since 2016 and its classifiers declare support only through Python 3.4, making it a legacy tool. If your project runs on modern Python versions, you should verify compatibility before relying on it in production.
Use it for:
- Build permission rules that require multiple conditions to be true simultaneously.
- Negate a permission to deny access when a condition is met.
- Combine permission checks with OR logic to allow access if any one of several conditions is satisfied.
- Express complex multi-condition access policies without writing custom permission classes for every combination.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides logical operators (And, Or, Not) to compose complex permission checks in Django REST Framework views, allowing you to combine multiple permission classes with boolean logic.
No, unless you are maintaining legacy code already using this package. The library is abandoned (last release 2016-11-01, last commit 2019-01-04) and declares support only through Python 3.4. Modern projects should implement permission composition directly or use actively maintained alternatives. If you must use it, verify compatibility with your current Python and framework versions before deploying.
Install
rest-condition on PyPI
pip
pip install rest-conditionuv
uv add rest-conditionpoetry
poetry add rest-conditionInstalling rest_condition
Before you install
High install friction: no runtime dependencies but the package is abandoned (last commit 2019-01-04, 3573 days without release). Classifiers declare support only through Python 3.4, which is severely outdated. Installation will succeed but the codebase is unmaintained.
License in practice
MIT license is permissive and poses no restrictions on use or redistribution. You may use, modify, and distribute this package freely in commercial or private projects.
Quickstart
pip install rest_condition
from rest_condition import ConditionalPermission, C, And, Or, Not
# Compose permission expressions
permission_classes = [Or(And(Perm1, Perm2), Not(Perm2))]
Requires Django and django-rest-framework to be installed separately; no explicit version constraints are declared in the package metadata.
Verify before relying
- Whether the package works correctly with modern Python versions despite classifiers only listing through Python 3.4.
- Whether the package is compatible with current versions of the frameworks it depends on.
- Whether there are known bugs or edge cases in the boolean permission composition logic.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,573 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,960/month — #13,356 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rest_condition-1.0.3.tar.gz
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
dry-rest-permissionsDefines rules-based permissions for Django REST…
permissive · top 15,000 on PyPI
djangorestframework-guardianIntegrates django-guardian's object-level…
permissive · top 15,000 on PyPI
bridgekeeperBridgekeeper provides a permissions system for…
permissive · top 15,000 on PyPI
adrfAdds async/await support to Django REST…
permissive · top 15,000 on PyPI
boolean.pyParse, simplify, and compare boolean…
permissive · top 1,000 on PyPI
zope.securityProvides a generic security framework for…
unclear · top 15,000 on PyPI
djangorestframework-role-filtersAdds role-based access control to Django REST…
permissive · top 5,000 on PyPI
authAn HTTP authorization service that answers…
permissive · top 15,000 on PyPI
django-permissionedformsExtends Django's forms framework to…
permissive · top 5,000 on PyPI
conditionalConditionally apply a context manager to a code…
permissive · top 15,000 on PyPI