pymacaroons
Macaroon library for Python
What it is and what it does
PyMacaroons is a pure-Python implementation of macaroons, a cryptographic authorization primitive that works like bearer tokens but with embedded authorization constraints called caveats. Unlike opaque tokens, macaroons allow the issuing service to embed specific authorization rules directly into the credential—for example, restricting access to a particular resource or time window—without requiring a separate lookup. The verifier can then check both the cryptographic integrity of the macaroon and whether all embedded caveats are satisfied in the current context.
The library depends on PyNaCl for cryptographic operations and six for Python 2/3 compatibility. It is designed for portability and ease of installation, trading some speed for the convenience of a pure-Python implementation. The package is stable and dormant, with no active development but a maintained repository; it is suitable for systems that need macaroon support and can tolerate the lack of recent updates.
Use it for:
- Issue time-limited or resource-scoped bearer tokens for API access without maintaining a separate authorization database.
- Delegate authorization to third parties by creating attenuated macaroons with additional caveats that restrict what the delegate can do.
- Verify incoming credentials in a service by checking both the signature and the satisfaction of all embedded authorization constraints.
- Implement decoupled authorization policy where rules are embedded in the token itself rather than enforced centrally.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyMacaroons implements macaroons—bearer credentials with embedded authorization caveats that can be created, serialized, and cryptographically verified.
Yes, if you need macaroon support and can accept dormant maintenance. The package is stable, has no known vulnerabilities, and low install friction. However, if you require active development, recent Python version support beyond 3.9, or performance-critical use, consider whether libmacaroons bindings or an alternative bearer token scheme better fits your needs.
Install
pymacaroons on PyPI
pip
pip install pymacaroonsuv
uv add pymacaroonspoetry
poetry add pymacaroonsInstalling pymacaroons
Before you install
Installation is straightforward with low friction. The package is dormant—last release was in 2018 and the last commit in 2024—but the repository remains active and the implementation is considered stable by its maintainers.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute PyMacaroons with minimal legal restriction.
Quickstart
from pymacaroons import Macaroon, Verifier
m = Macaroon(
location='service.example.com',
identifier='key-id',
key='secret-signing-key'
)
m.add_first_party_caveat('resource = photo.jpg')
serialized = m.serialize()
v = Verifier()
v.satisfy_exact('resource = photo.jpg')
verified = v.verify(m, 'secret-signing-key')
Verify before relying
- Whether the package works reliably with modern Python versions beyond 3.9 (CI builds mentioned 2.7, 3.5–3.9, and PyPy3, but no recent test coverage documented)
- Performance characteristics compared to libmacaroons or other bearer token schemes in production scenarios
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — PyNaCl, six |
| Maintenance | dormant — 3,096 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,015,507/month — #4,502 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymacaroons-0.13.0-py2.py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
macaroonbakeryMacaroonbakery provides HTTP authentication and…
copyleft · top 5,000 on PyPI
pycookiecheatExtracts and decrypts cookies from Chrome,…
permissive · top 15,000 on PyPI
josepyImplements the JOSE (JSON Object Signing and…
permissive · top 5,000 on PyPI
drf-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
django-allauthProvides integrated local and social…
permissive · top 5,000 on PyPI
propelauth-pyValidates access tokens and manages user…
permissive · top 15,000 on PyPI
scitokensImplements the SciTokens JSON Web Token (JWT)…
permissive · top 15,000 on PyPI
joseImplements JSON Web Signature (JWS) and JSON…
permissive · top 15,000 on PyPI
aws-bedrock-token-generatorGenerates short-term bearer tokens for AWS…
permissive · top 5,000 on PyPI
standardwebhooksProvides webhook payload verification and…
permissive · top 5,000 on PyPI