pyramid-sa
Pyramid SQLAlchemy Integration — a reusable library that wires SQLAlchemy into any Pyramid application.
Features
- Session management — engine, transaction-managed sessions,
request.dbsession - Declarative base —
Basewith naming conventions and utility methods (as_dict,copy_with) - Audit trail — opt-in
AuditMixintracking created/updated by whom and when - Soft delete — opt-in
SoftDeleteMixinwith query filtering, unique indexes, and safe restore - Error mapping —
NoResultFound→ 404,IntegrityError→ 409, with customizable bodies - JSON rendering —
datetime,date,UUIDadapters out of the box - Alembic scaffold —
db init-alembicfor pre-wired migration setup - CLI commands —
db drop,db initializefor schema management - Test fixtures — companion
pyramid-sa-testingpackage with PostgreSQL-backed pytest plugin
Documentation
Full documentation is available at tomascorrea.github.io/pyramid-sa.
- Getting Started — installation, app factory wiring, what
includesets up - Models —
BasevsModel,as_dict(),copy_with(), mixins - Database & Migrations — Alembic scaffold, CLI commands,
env.pysetup - Audit Trail —
AuditMixincolumns and automatic field population - Soft Delete —
SoftDeleteMixin, filtering, unique indexes, restore - Error Handling — exception tween, custom error formatters
- Testing — pytest fixtures, transaction isolation,
conftest.pysetup - API Reference — full public API by module
Installation
pip install pyramid-sa
For test fixtures (dev only):
pip install pyramid-sa-testing
Quick Start
Wire pyramid-sa into your Pyramid app factory:
from pyramid.config import Configurator
def create_app(global_config=None, dbengine=None, **settings):
config = Configurator(settings=settings)
if dbengine is not None:
config.registry["dbengine"] = dbengine
config.include("pyramid_sa")
config.sa_enable_audit() # optional: auto-populate audit fields
config.sa_enable_soft_delete() # optional: soft-delete behavior
config.sa_scan_models("myapp.models")
config.scan(".views")
return config.make_wsgi_app()
See Getting Started for a full walkthrough of what config.include("pyramid_sa") sets up, model definitions, and next steps.
Development
uv sync --dev
uv run pytest
uv run ruff check .
uv run black .
License
MIT
Metadata
Release files for pyramid-sa 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyramid_sa-0.9.0.tar.gz | 110.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyramid_sa-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.9 kB
Release files / pyramid_sa-0.9.0.tar.gz
| Download URL | pyramid_sa-0.9.0.tar.gz |
|---|---|
| Size | 110.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56dbc5d0d2e26e389f141f8ae3fe7e44443d1bb89e8485be38213b859cae5994
|
|
BLAKE2b-256 checksum How to use checksums |
b9e2dc1e476697d14796024e5c295c2a26eef548e5efb75fe9640126aa6d6d51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency logRelease files / pyramid_sa-0.9.0-py3-none-any.whl
| Download URL | pyramid_sa-0.9.0-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2f07a6d5ca06218c424487e92672951f500859bbafc377f107946a42f778d56
|
|
BLAKE2b-256 checksum How to use checksums |
2b63e8c4ef5f066fc9751c9389ded0bd54837f8ee2ace3e14889d57320525e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency log