Repository navigation
Conversation
Natim
force-pushed
the
fix/pkg_resources
branch
3 times, most recently
from
August 4, 2026 09:46
5b9a6b1 to
6c008a4
Compare
added 2 commits
August 5, 2026 15:38
Asset overrides now resolve through Pyramid's own APIs via explicit IPackageOverrides registry lookup, removing the setuptools runtime dependency and the OverrideProvider loader hook.
Use lazy re-exports in pyramid.path to break the resolver circular import for docs autodoc, fix Windows path expectations, restore full coverage for override and re-export code paths, and remove an unused test import.
Natim
force-pushed
the
fix/pkg_resources
branch
from
August 5, 2026 13:39
6c008a4 to
14a816f
Compare
added 2 commits
August 5, 2026 15:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3731.
Removes all runtime use of
pkg_resourcesfrom Pyramid and replaces it withimportlib.resources. This drops thesetuptools < 82runtime pin and lets Pyramid work with modern setuptools releases wherepkg_resourcesis deprecated or unavailable.Asset overrides no longer hook into setuptools' global loader adapter (
OverrideProvider/register_loader_type). Instead, Pyramid's own asset APIs look upIPackageOverridesfrom the application registry explicitly.What changed
Resource access
pyramid.path.ref_filename()andpyramid.path.resource_filename()as helpers for filesystem access to package resources (including extraction from zipped distributions viaimportlib.resources.as_file()).PkgResourcesAssetDescriptorandPackageAssetSourceto useimportlib.resources.files().package_path(),static_view, andabspath_from_asset_spec()to go through the new resolution path.Asset overrides
OverrideProvider,pkg_resources.register_loader_type(), and thepackage.__loader__ = selfhack inPackageOverrides.AssetResolver.resolve()now queriesIPackageOverridesfrom the registry and passes overrides intoPkgResourcesAssetDescriptor.static_viewusesAssetResolverso overrides still work for static file serving.Module layout
Resolver,AssetResolver, andDottedNameResolverto the newpyramid.resolvermodule.pyramid.pathfor backward compatibility.Dependencies
setuptoolsfrom runtime dependencies inpyproject.toml.Backward incompatibilities
pkg_resourcescallers. Code that callspkg_resources.resource_filename()(or related APIs) directly will not see overrides registered viaconfig.override_asset(). Overrides apply only through Pyramid's asset APIs (AssetResolver,static_view,abspath_from_asset_spec, etc.).IPackageOverridesno longer extendsIPEP302Loader. The PEP 302 loader passthrough methods onPackageOverrideshave been removed.PackageOverridesno longer mutatespackage.__loader__.Test plan
2618tests)setuptools>=82installed (tested with83.0.0)tests/test_resolver.pyandtests/pkgs/assets/fixturestests/test_path.pyandtests/test_config/test_assets.py(removedOverrideProviderandpkg_resourcesmocks)override_asset()still works for static views, i18n translation dirs, and cache bustersDocumentation
docs/narr/assets.rst,docs/narr/extending.rst,docs/narr/environment.rst, anddocs/glossary.rstCHANGES.rstunder Features and Backward Incompatibilities