Repository navigation
Conversation
Contributor
|
I'm surprised this hasn't been done a long time ago.
At first glance I see some pep8 formatting issue (need two blank lines
between classes). Not sure if Pyramid runs linting on the style like black
or ruff.
…On Sat, 7 Nov 2026 at 23:04, Gerhard Schmidt ***@***.***> wrote:
pkg_resources is gone for nearly a year now. There are three new releases
of Setuptools and pyramid is stuck with 80.
I am not that deep in the code to really remove the dependency myself. But
there are AI out there who should. So I asked Junie, the AI of Jetbrains
PyCharms to do the deed and here is what it produced. It might not include
all edge cases, but it could provide a start.
Here is the Summery the AI produced.
Replaced the deprecated pkg_resources usage with modern standard library
alternatives (importlib.resources and importlib.metadata).
Changes
• Replaced pkg_resources in src/pyramid/path.py by implementing
PackageAssetDescriptor backed by importlib.resources.files() and updating
package_path() to use importlib.resources.
• Updated src/pyramid/asset.py to use PackageAssetDescriptor for
abspath_from_asset_spec() instead of pkg_resources.resource_filename().
• Updated src/pyramid/static.py to use PackageAssetDescriptor for checking
directory existence and locating resource paths without importing
pkg_resources.
• Updated src/pyramid/config/assets.py so PackageAssetSource and
_DefaultProvider delegate to PackageAssetDescriptor / importlib.resources,
making pkg_resources optional and avoiding its deprecated import during
runtime.
• Updated tests/test_docs.py to use importlib.metadata and updated
tests/test_path.py to test PackageAssetDescriptor functionality.
Verification
• Ran the full test suite (./venv/bin/pytest) with all 2,652 tests passing.
• Verified with ./venv/bin/python -W error::UserWarning that importing and
initializing Pyramid modules and Configurator produces no deprecation
warnings.
Please check the code as it's mostly AI generated. Don't trust them :-)
------------------------------
You can view, comment on, or merge this pull request online at:
#3833
Commit Summary
- 5dc4591
<5dc4591>
Replace pkg_resources usage with importlib resources
- ac7062b
<ac7062b>
Remove setuptools upper bound
File Changes
(7 files <https://github.com/Pylons/pyramid/pull/3833/files>)
- *M* pyproject.toml
<https://github.com/Pylons/pyramid/pull/3833/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711>
(2)
- *M* src/pyramid/asset.py
<https://github.com/Pylons/pyramid/pull/3833/files#diff-850a874858c35295f672403fdfd49da979904b95e949932b9e367744f0741640>
(9)
- *M* src/pyramid/config/assets.py
<https://github.com/Pylons/pyramid/pull/3833/files#diff-c19c18805bd569c98cb796da486101f4c719cd86a6ebe60e8cfb3453afd9aed3>
(107)
- *M* src/pyramid/path.py
<https://github.com/Pylons/pyramid/pull/3833/files#diff-cd088b2cb214f49725a325b6a439057eb67e19a74548b1012fcb52aed23ebddb>
(101)
- *M* src/pyramid/static.py
<https://github.com/Pylons/pyramid/pull/3833/files#diff-cf22408d74e2fa729783f892faf8ab0da599bb8feab4c2b6d5d63f69434bb1d4>
(10)
- *M* tests/test_docs.py
<https://github.com/Pylons/pyramid/pull/3833/files#diff-5c6dddc0c85981eb75bdb49d400e82c9271918e138990baba53ac34cbcf2aaac>
(4)
- *M* tests/test_path.py
<https://github.com/Pylons/pyramid/pull/3833/files#diff-0652dfe0a27944c93f98bfe064e2a6414d62710e0de3022646e8ec863d6d3467>
(31)
Patch Links:
- https://github.com/Pylons/pyramid/pull/3833.patch
- https://github.com/Pylons/pyramid/pull/3833.diff
—
Reply to this email directly, view it on GitHub
<#3833?email_source=notifications&email_token=AAHYWMVISIC54IWI6FDXWCL5X3XSBA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42TEMBQGUYTSMZXGKTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHYWMTEDVV3RCJTQNZRTYL5X3XSBAVCNFSNUABDKJSXA33TNF2G64TZHMYTAMRQGYZTSO2JONZXKZJ3GYZDKNZXGM2DQMBVUF3AE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Contributor
Author
|
It would be nice when the checks would report what's wrong instead of just error. How can I start the lint in a local installation. |
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.
pkg_resources is gone for nearly a year now. There are three new releases of Setuptools and pyramid is stuck with 80.
I am not that deep in the code to really remove the dependency myself. But there are AI out there who should. So I asked Junie, the AI of Jetbrains PyCharms to do the deed and here is what it produced. It might not include all edge cases, but it could provide a start.
Here is the Summery the AI produced.
Replaced the deprecated pkg_resources usage with modern standard library alternatives (importlib.resources and importlib.metadata).
Changes
• Replaced pkg_resources in src/pyramid/path.py by implementing PackageAssetDescriptor backed by importlib.resources.files() and updating package_path() to use importlib.resources.
• Updated src/pyramid/asset.py to use PackageAssetDescriptor for abspath_from_asset_spec() instead of pkg_resources.resource_filename().
• Updated src/pyramid/static.py to use PackageAssetDescriptor for checking directory existence and locating resource paths without importing pkg_resources.
• Updated src/pyramid/config/assets.py so PackageAssetSource and _DefaultProvider delegate to PackageAssetDescriptor / importlib.resources, making pkg_resources optional and avoiding its deprecated import during runtime.
• Updated tests/test_docs.py to use importlib.metadata and updated tests/test_path.py to test PackageAssetDescriptor functionality.
Verification
• Ran the full test suite (./venv/bin/pytest) with all 2,652 tests passing.
• Verified with ./venv/bin/python -W error::UserWarning that importing and initializing Pyramid modules and Configurator produces no deprecation warnings.
Please check the code as it's mostly AI generated. Don't trust them :-)