pyramid-tm
A package which allows Pyramid requests to join the active transaction
What it is and what it does
pyramid_tm is a Pyramid web framework extension that automatically binds each HTTP request to a transaction managed by the transaction package. When you include it in your Pyramid application, every request gets its own transaction context that commits on success or aborts on exception, eliminating manual transaction boilerplate in request handlers.
The package runs as a Pyramid tween (middleware layer) positioned to wrap exception views, meaning the transaction remains active even when handling errors. It supports customization through hooks like commit_veto to override commit/abort decisions, and tm.annotate_user to track authenticated users in transaction logs. It integrates with pyramid_retry for automatic transaction retry on transient errors.
Use it for:
- Automatically commit database changes at the end of a successful HTTP request without explicit transaction calls in view code.
- Abort database transactions when an exception occurs, rolling back partial changes and returning an error response.
- Track which user performed a transaction by annotating the transaction log with authenticated user identity.
- Implement custom commit/abort logic via commit_veto hooks to decide whether to persist changes based on response status or headers.
- Coordinate multi-step database operations across a single request lifecycle with automatic rollback on failure.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Pyramid web requests with the transaction package to manage database transactions declaratively across request lifecycles.
Yes. pyramid_tm is a mature, actively maintained package (last release November 2024) with no known vulnerabilities, low install friction, and a permissive license. It solves a common problem in Pyramid applications—declarative transaction management per request—cleanly and with minimal configuration. Install it if you are building a Pyramid web application that uses a database.
Install
pyramid-tm on PyPI
pip
pip install pyramid-tmuv
uv add pyramid-tmpoetry
poetry add pyramid-tmInstalling pyramid-tm
Before you install
Low friction install with only two runtime dependencies (pyramid and transaction). Actively maintained with recent releases supporting Python 3.9–3.13; last commit in 2026.
License in practice
Licensed under a permissive BSD-derived (Repoze) license, allowing commercial and private use without restriction.
Quickstart
pip install pyramid-tm
from pyramid.config import Configurator
config = Configurator()
config.include('pyramid_tm')
app = config.make_wsgi_app()
Requires Python 3.9 or later; pyramid_tm must be included in the Configurator to activate transaction management for requests.
Verify before relying
- Whether pyramid_retry is required or optional for retry behavior after version 2.0.
- Performance impact of transaction annotation when tm.annotate_user is enabled.
- Compatibility details with specific versions of pyramid and transaction beyond the stated support range.
Package facts
| License | BSD-derived (Repoze) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pyramid, transaction |
| Maintenance | actively maintained — 638 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 437,936/month — #6,662 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyramid_tm-2.6-py3-none-any.whl
Keywords: wsgi, pylons, pyramid, transaction
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
pyramid-retrypyramid_retry wraps Pyramid requests with…
permissive · top 15,000 on PyPI
transactionProvides a generic transaction management…
unclear · top 5,000 on PyPI
pyramidPyramid is a Python web framework for building…
permissive · top 5,000 on PyPI
zope.sqlalchemyIntegrates SQLAlchemy sessions with Zope's…
unclear · top 15,000 on PyPI
pyramid-debugtoolbarPyramid_debugtoolbar injects an interactive…
permissive · top 5,000 on PyPI
pyramid-jinja2Integrates the Jinja2 templating engine with…
permissive · top 5,000 on PyPI
repoze-sendmailCouples email sending with Zope transactions,…
permissive · top 15,000 on PyPI
pyramid-makoIntegrates the Mako templating engine with the…
permissive · top 5,000 on PyPI
paytmchecksumGenerates and verifies checksums for Paytm…
permissive · top 15,000 on PyPI
eth-accounteth-account signs Ethereum transactions and…
permissive · top 5,000 on PyPI