pyramid_basemodel
pyramid_basemodel is a thin, low level package that provides an SQLAlchemy declarative Base and a thread local scoped Session that can be used by different packages whilst only needing to be bound to a db engine once.
Usage
You can use these as base classes for declarative model definitions, e.g.:
from pyramid_basemodel import Base, BaseMixin, Session, save
class MyModel(Base, BaseMixin):
"""Example model class."""
@classmethod
def do_foo(cls):
instance = Session.query(cls).first()
save(instance)
You can then bind these to the sqlalchemy.url in your paster .ini config by importing your model and this package, e.g.:
# for example in yourapp.__init__.py
import mymodel
def main(global_config, **settings):
config = Configurator(settings=settings)
config.include('pyramid_basemodel')
config.include('pyramid_tm')
return config.make_wsgi_app()
Or if this is all too much voodoo, you can just use the bind_engine function:
from pyramid_basemodel import bind_engine
from mypackage import mymodel
# assuming `engine` is a bound SQLAlchemy engine.
bind_engine(engine)
Note that the Session is designed to be used in tandem with [pyramid_tm][]. If you don’t include pyramid_tm, you’ll need to take care of committing transactions yourself.
Tests
To run the tests use:
py.test -v --cov pyramid_basemodel tests/
[pyramid_basemodel]: http://github.com/fizyk/pyramid_basemodel [pyramid_simpleauth]: http://github.com/thruflo/pyramid_simpleauth [pyramid_tm]: http://pyramid_tm.readthedocs.org
Metadata
Release files for pyramid-basemodel 1.0.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_basemodel-1.0.0.tar.gz | 16.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyramid_basemodel-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.2 kB
Release files / pyramid_basemodel-1.0.0.tar.gz
| Download URL | pyramid_basemodel-1.0.0.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd3f07eaa82aac1657d17be2fdf52101d8633b3fbb9f0663c0a095b87ebb3083
|
|
BLAKE2b-256 checksum How to use checksums |
62fd142f255f8d84dc9c25355be8a3b8bbe14485ea1d2db51f629cb0850e2fdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 5, 2026.
Transparency logRelease files / pyramid_basemodel-1.0.0-py3-none-any.whl
| Download URL | pyramid_basemodel-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e84545f061746b386df501afa0e89f1493be581785f628012456387ea6de0285
|
|
BLAKE2b-256 checksum How to use checksums |
917e86b713994fcbcd359f2cd951253d76ef2c42da1b699579b262c832c4e7a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 5, 2026.
Transparency log