skillfed

macaroonbakery

A Python library port for bakery, higher level operation to work with macaroons

macaroonbakery v1.3.4 830.0K downloads/30d#4,950 on PyPI9
Copyleft license LGPL3 DORMANT released

What it is and what it does

Macaroonbakery is a Python library that implements higher-level operations for working with macaroons—cryptographic authorization tokens—in HTTP contexts. It provides a BakeryAuth handler that integrates with the requests library to transparently manage macaroon cookies across multiple HTTP requests to protected endpoints. The library handles the complexity of macaroon validation and cookie storage, allowing developers to authenticate to macaroon-protected services without manually managing the cryptographic handshake.

The package depends on a substantial cryptographic stack (PyNaCl, cryptography, pyOpenSSL, pymacaroons) and is designed primarily for systems that use macaroon-based authorization schemes. It was developed as a port of Go's macaroon-bakery library and is most useful in environments where macaroon authentication is already the standard—such as Juju, Canonical's orchestration platform, or other systems built around macaroon-based access control.

Use it for:

  • Authenticate to Juju or other macaroon-bakery-protected services using Python HTTP clients.
  • Manage macaroon cookies across multiple requests to the same protected API without re-authenticating.
  • Integrate macaroon-based authorization into Python applications that need to call protected endpoints.
  • Handle cryptographic cookie validation and refresh transparently in HTTP workflows.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Macaroonbakery provides HTTP authentication and cookie handling for macaroon-based access control, integrating with the requests library to manage macaroon cookies across protected API calls.

Yes, but with caution. Install if you need to authenticate to a macaroon-bakery-protected service and have no alternative. The low install friction and absence of known vulnerabilities are positives, but the dormant maintenance status (975 days since last release, no commits since May 2024) and outdated Python version support (classifiers only list up to 3.5) mean you should verify compatibility with your target Python version and dependencies before committing to production use.

Install

macaroonbakery on PyPI

pip

pip install macaroonbakery

uv

uv add macaroonbakery

poetry

poetry add macaroonbakery

Installing macaroonbakery

Before you install

Low install friction with a pure-Python wheel, but maintenance is dormant—last release was 975 days ago and the repository shows no recent commits since 2024-05-23. The 11 runtime dependencies include cryptographic libraries (PyNaCl, cryptography, pyOpenSSL) that may require system libraries like libsodium on some platforms.

License in practice

Licensed under LGPLv3 (copyleft). Any derivative work or modification must be released under the same license; static linking or bundling may trigger copyleft obligations depending on how you distribute the software.

Quickstart

pip install macaroonbakery

from macaroonbakery import httpbakery
import requests

jar = requests.cookies.RequestsCookieJar()
resp = requests.get('https://example.com/protected',
                    cookies=jar,
                    auth=httpbakery.BakeryAuth(cookies=jar))

libsodium system library may be required on some platforms; see installation notes for Ubuntu/Debian setup.

Verify before relying

  • Whether the package works reliably with modern Python versions (classifiers list only up to 3.5, released 2015).
  • Current compatibility with recent versions of protobuf, PyNaCl, and cryptography dependencies.
  • Whether dormant status indicates the package is still maintained or has been superseded.

Package facts

License LGPL3 (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 11 — PyNaCl, protobuf, pyRFC3339, pymacaroons, requests, six, cryptography, ndg-httpsclient, pyOpenSSL, pyasn1, ipaddress
Maintenance dormant — 975 days since the last release
Last repo commit
First released
Downloads 830,025/month — #4,950 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: macaroonbakery-1.3.4-py2.py3-none-any.whl

Keywords: macaroon, cookie

Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Natural Language :: EnglishProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.5

Tags

macaroon authenticationHTTP cookie bakerymacaroon-based access controlrequests library auth handlercryptographic cookie managementmacaroon session handlingprotected API authentication
macaroon-authhttp-cookiescryptographic-tokens

More Cryptography packages