skillfed

pyramid-tm

A package which allows Pyramid requests to join the active transaction

pyramid-tm v2.6 437.9K downloads/30d#6,662 on PyPI36
Permissive license BSD-derived (Repoze) Active released

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-tm

uv

uv add pyramid-tm

poetry

poetry add pyramid-tm

Installing 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

Development Status :: 6 - MatureFramework :: PyramidIntended Audience :: DevelopersLicense :: Repoze Public LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

pyramid transaction managementwsgi request transaction handlingpyramid database transaction integrationautomatic transaction commit abortpyramid request lifecycle transactionstransaction manager pyramid tweendeclarative transaction control
pyramid-integrationtransaction-managementwsgi-middleware

More Application Frameworks packages