Skip to content

Reorganize resolvers#3816

Open
luhn wants to merge 7 commits into
Pylons:mainfrom
luhn:reorg-resolvers
Open

Reorganize resolvers#3816
luhn wants to merge 7 commits into
Pylons:mainfrom
luhn:reorg-resolvers

Conversation

@luhn
Copy link
Copy Markdown
Contributor

@luhn luhn commented Mar 29, 2026

This PR moves Resolver subclasses and IAssetDescriptor implementations to pyramid.resolver. The remaining contents of pyramid.path gets moved to pyramid._path, so that pyramid.path can expose the same API without a circular dependency.

In a future change, AssetResolver passes IPackageOverrides into PkgResourceAssetDescriptor. This means that AssetResolver now requires registry, which falls back to get_current_registry(). This results in a circular dependency: pyramid.path now imports pyramid.threadlocal imports pyramid.registry imports pyramid.path.

Ways I considered resolving this:

  • Make registry a mandatory argument for AssetResolver.
  • Make registry optional with no threadlocal fallback. (overrides just won't work)
  • Move AssetResolver et al to new package and remove from pyramid.path entirely.
  • Move AssetResolver et al to new package and put AssetResolver import at the very bottom of pyramid.path—Almost works but importing pyramid.resolver first still gives circular import.
  • Move AssetResolver et al to new package and use pyramid._path to keep AssetResolver in pyramid.path.

The last one (this PR) seems like the only feasible solution, even though _path.py is a bit icky.

luhn added 4 commits March 29, 2026 08:34
Move resolver-related things into `pyramid.resolver`.  Move the rest
into `pyramid._path`, which is necessary to resolve circular for future
changes.
@luhn
Copy link
Copy Markdown
Contributor Author

luhn commented Mar 29, 2026

@mmerickel would we want to mark pyramid.path.AssetResolver et al as deprecated? I'm hesitant because that's a pretty big deprecation, but if sometime in the future if we want to get from _path.py back to path.py that'll be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant