What's New in Pyramid 2.1¶
This article explains the new features in Pyramid version 2.1 as compared to its predecessor, Pyramid 2.0. It also documents backwards incompatibilities between the two versions and deprecations added to Pyramid 2.1, as well as software dependency changes and notable documentation additions.
Acknowledgments¶
Work on this release has been generously sponsored by pyfidelity UG via Florian Schulze (fschulze@pyfidelity.com), maintainer of devpi. Thank you!
Major Feature Additions¶
Add support for Python 3.12, 3.13, and 3.14.
Constrain
setuptools < 82to remain compatible with requiredpkg_resourcesfeatures. Work continues to fully removepkg_resourcesfrom Pyramid code in future releases. See https://github.com/Pylons/pyramid/pull/3795Added HTTP 418 error code via
pyramid.httpexceptions.HTTPImATeapot. See https://github.com/Pylons/pyramid/pull/3667All scripts now pass a new option
__script__when loading the WSGI app. For example,pservesets__script__ == 'pserve'. This works forpserve,pshell,prequest,proutes,ptweens,pviews, as well as when usingpyramid.paster.bootstrap()directly.When using
plaster-pastedeployto load an INI file, this option will manifest as a new value passed into theglobal_confarg of your application factory, where you can use it as part of initializing your app.
Minor Feature Additions¶
Base coverage reports in tests on Python 3.14 instead of Python 3.8.
Replace usage of
md5in the Pyramid view system withsha256. This is not a security-related feature and is considered an implementation detail that should not impact users.Replace usage of
pkg_resourcesinpyramid.path.DottedNameResolver. See https://github.com/Pylons/pyramid/pull/3748Replace usage of
pkg_resourcesinpdistreportandpshellCLI commands. See https://github.com/Pylons/pyramid/pull/3749Remove internal usages of deprecated
localeanddatetimeAPIs to reduce deprecation warnings. See https://github.com/Pylons/pyramid/pull/3808
Deprecations¶
Deprecated the ability to use a non-existent package with
pyramid.config.Configurator.add_static_view()andpyramid.static.static_view. This can be fixed by choosing a path located within a real package as theroot_dirfor your static files. This is almost always either a misconfig or an attempt to define an alias location for use withpyramid.config.Configurator.override_asset(). See https://github.com/Pylons/pyramid/pull/3752
Backward Incompatibilities¶
Drop support for Python 3.6, 3.7, 3.8, and 3.9.
Drop support for l*gettext() methods in the i18n module. These have been deprecated in Python's gettext module since 3.8, and removed in Python 3.11.
Add get_spec method to
pyramid.interfaces.IPackageOverrides. See https://github.com/Pylons/pyramid/pull/3792When using a cache buster with asset overrides, the cache buster will find the first existing file in the override stack, rather than taking the first override regardless of whether the file exists or not. See https://github.com/Pylons/pyramid/pull/3792
Documentation Enhancements¶
Sync the SQLAlchemy Wiki tutorial with changes to the
pyramid-cookiecutter-starter. Includes updates to usepyproject.tomlto replace separate config files forpytest,coverage, andsetuptools. Also upgrades patterns to support SQLAlchemy 2.0. See https://github.com/Pylons/pyramid/pull/3747Sync the ZODB Wiki tutorial with changes to the
pyramid-cookiecutter-starter. Includes updates to usepyproject.tomlto replace separate config files forpytest,coverage, andsetuptools. See https://github.com/Pylons/pyramid/pull/3751