skillfed

Beaker

A Session and Caching library with WSGI Middleware

beaker v1.14.1 269.6K downloads/30d#8,256 on PyPI
Permissive license BSD Active released

What it is and what it does

Beaker is a session and caching library designed for WSGI web applications. It abstracts storage across multiple backends—memory, file, database (via SQLAlchemy), memcached, Redis, and MongoDB—allowing you to choose the right persistence layer for your use case without changing application code. It includes WSGI middleware for transparent session and cache integration, signed cookies to prevent session hijacking, and cookie-only sessions for clustered deployments that don't require a backend store.

The library handles cache namespacing, key expiration, automatic cache regeneration via callbacks, and fine-grained backend toggling per cache object. It has been in production use since 2006 and is integrated into frameworks like Pylons and TurboGears. With zero runtime dependencies and support for Python 3.8–3.13, it is straightforward to install and integrate into existing WSGI applications.

Use it for:

  • Store user sessions in memcached or Redis for horizontally scaled web services.
  • Cache expensive database queries or API responses with automatic expiration.
  • Use signed cookies for stateless session management in clustered environments.
  • Implement multi-tier caching (memory + persistent backend) with namespace isolation.
  • Integrate session middleware into a Pylons or TurboGears application with minimal configuration.

Worth the install?

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

Beaker provides session management and caching for WSGI web applications, supporting multiple storage backends including memory, file, database, memcached, Redis, and MongoDB.

Yes, with a security caveat. Beaker is production-stable, actively maintained, has zero install friction, and offers a mature, flexible caching and session abstraction for WSGI applications. However, verify whether PYSEC-2020-216 affects version 1.14.1 before deploying to production; if unpatched, assess the risk in your threat model.

Install

beaker on PyPI

pip

pip install beaker

uv

uv add beaker

poetry

poetry add beaker

Installing Beaker

Before you install

Low install friction with no runtime dependencies. Actively maintained as of 76 days ago with production-stable status across Python 3.8–3.13.

License in practice

BSD permissive license allows use in most projects without significant restrictions.

Quickstart

pip install beaker

from beaker.cache import CacheManager
from beaker.session import SessionObject

cache_opts = {'cache.type': 'memory'}
cache = CacheManager(**cache_opts)

Requires Python 3.8 or later; optional backends (Redis, memcached, MongoDB) require their respective client libraries.

Verify before relying

  • Whether PYSEC-2020-216 affects current version 1.14.1 or has been patched.
  • Performance characteristics and scalability limits for high-concurrency scenarios.
  • Current maintenance activity level beyond release date (last commit, recent PRs).

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 76 days since the last release
First released
Downloads 269,610/month — #8,256 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities 1 — PYSEC-2020-216

Evidence: beaker-1.14.1-py3-none-any.whl

Keywords: wsgi, myghty, session, web, cache, middleware

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Internet :: WWW/HTTP :: WSGITopic :: Internet :: WWW/HTTP :: WSGI :: Middleware

Tags

wsgi session middlewareweb application cachingdistributed session storagememcached redis cachingcookie-based sessionscache backend abstractionweb framework session management
session-managementcaching-librarywsgi-middleware

More Dynamic Content packages