Skip to content

Asset overrides [WIP]#3791

Draft
luhn wants to merge 11 commits intoPylons:mainfrom
luhn:asset-overrides
Draft

Asset overrides [WIP]#3791
luhn wants to merge 11 commits intoPylons:mainfrom
luhn:asset-overrides

Conversation

@luhn
Copy link
Contributor

@luhn luhn commented Aug 25, 2025

Fixes #3731

Copy link

@sbrunner sbrunner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :-)

@mmerickel
Copy link
Member

@luhn we should try to coordinate what is going on here as I have a lot of thoughts on how to do this as well and it'll simplify merging if we can get on the same page. I'm out until monday but otherwise maybe you can hop in discord to chat about it at some point? Or I can try to chat here if you prefer, just more slowly.

@luhn
Copy link
Contributor Author

luhn commented Feb 26, 2026

Yeah that sounds great! I'm electricspice over on Discord. I'm similarly occupied through the weekend but past that I am fairly available during evenings (ZoneInfo('America/Los_Angeles')) or could likely carve out some time during the workday.

I haven't touched this PR really at all in the past few months, but now that things are moving again I'm freshly motivated. I'll need to do some review to refresh my self on this stuff.

Broadly, the path I'm pursuing here is based on your comments over in #3731, particularly:

I think we'd have to make the asset resolution apis work "correctly" without pkg_resources, and then offer an extra api to opt-in to binding the data to pkg_resources if someone wants it.

Pyramid should offer its own apis (it does, AssetResolver), that work properly without those dependencies, and that's the focus here

So:

a) Replace pkg_resources usage with importlib.
b) Implement asset overrides within the Pyramid's asset APIs, rather than relying on pkg_resources mechanisms. AFAICT the existing AssetResolver implementation already does this.
c) Add a legacy mode that registers overrides with pkg_resources. I'd like this to automatically engage if pkg_resources is present in the environment.
d) Deprecate certain APIs, particularly around resource filenames.
e) Update documentation with guidance on migrating from pkg_resources to Pyramid's AssetResolver

Open questions:

  • Hook into importlib machinery to register overrides globally? Personally I don't have much interest in this; I think Pyramid configuration should stay within Pyramid.
  • Additional convenience APIs for accessing resources? You can use AssetResolver directly but may be nice to give a more ergonomic API.

Looking forward to syncing up, I'm happy to be working on this but definitely want to make sure my efforts align with your ideas and goals.

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.

pkg_resources is deprecated

3 participants