-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Officially deprecate pkg_resources #3843
Merged
Merged
Conversation
This file contains 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
jaraco
force-pushed
the
debt/deprecate-pkg_resources
branch
from
March 5, 2023 14:34
2e2a7d5
to
eb46a88
Compare
I expect this change to have minimal impact on users of Setuptools as a build tool because |
This was referenced Mar 28, 2023
mdickinson
added a commit
to enthought/envisage
that referenced
this pull request
Apr 3, 2023
This PR fixes mutable-global-state-related issues with the egg-based tests (again). The root cause of the problems is that we're interfacing with an ill-defined (and now [deprecated](pypa/setuptools#3843) and unmaintained) API in `setuptools` code, which makes those interactions fragile, and that tests make significant changes to global state. The immediate cause of the issues is that we were trying to undo changes to `pkg_resources` global state by replacing the global `pkg_resources.working_set` with a fresh `WorkingSet` object during test teardown, but that `WorkingSet` object was missing some of the initialization (registered callbacks) that the original `WorkingSet` had. The main change in this PR is to try to undo global state changes by _mutating_ the existing `pkg_resources.working_set` back to its original state, instead of replacing `pkg_resources.working_set`. Alongside that, we've reorganised the relevant tests to share common machinery (now in `envisage.tests.support`) and to make use of context managers for cleanup. Fixes #440 Fixes #563 The test suite also now runs cleanly under the `haas` test runner.
8 tasks
fanquake
added a commit
to bitcoin-core/gui
that referenced
this pull request
Aug 29, 2023
…ith importlib.metadata 6c008a2 script: replace deprecated pkg_resources with importlib.metadata (Jon Atack) Pull request description: Running our python linter with a recent python and the latest release of setuptools [v68.1.2](https://setuptools.pypa.io/en/stable/history.html): ``` $ python3 --version Python 3.11.5 $ ./test/lint/lint-python.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources ``` Using `pkg_resources` was [deprecated](pypa/setuptools#3843) earlier in [v67.5.0](https://setuptools.pypa.io/en/stable/history.html#id55): "Although pkg_resources has been discouraged for use, some projects still consider pkg_resources viable for usage. This change makes it clear that pkg_resources should not be used, emitting a DeprecationWarning when imported." The `importlib.metadata` library requires Python 3.8, which is currently our minimum-supported Python version. For more details about `importlib.metadata` and the two methods imported and used here, see: - https://docs.python.org/3/library/importlib.metadata.html - https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.metadata - https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.PackageNotFoundError ACKs for top commit: MarcoFalke: lgtm ACK 6c008a2 (review only, did not test) Tree-SHA512: f5258d37043fcc9744f85641a60a3395ad43822c72d030dea8c39fa7f48ec3d7790cdeeb832f96e8f38046adb7c62fbc577c975ef0c77c8047c0c8f2353ce540
Frank-GER
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Sep 8, 2023
…rtlib.metadata 6c008a2 script: replace deprecated pkg_resources with importlib.metadata (Jon Atack) Pull request description: Running our python linter with a recent python and the latest release of setuptools [v68.1.2](https://setuptools.pypa.io/en/stable/history.html): ``` $ python3 --version Python 3.11.5 $ ./test/lint/lint-python.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources ``` Using `pkg_resources` was [deprecated](pypa/setuptools#3843) earlier in [v67.5.0](https://setuptools.pypa.io/en/stable/history.html#id55): "Although pkg_resources has been discouraged for use, some projects still consider pkg_resources viable for usage. This change makes it clear that pkg_resources should not be used, emitting a DeprecationWarning when imported." The `importlib.metadata` library requires Python 3.8, which is currently our minimum-supported Python version. For more details about `importlib.metadata` and the two methods imported and used here, see: - https://docs.python.org/3/library/importlib.metadata.html - https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.metadata - https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.PackageNotFoundError ACKs for top commit: MarcoFalke: lgtm ACK 6c008a2 (review only, did not test) Tree-SHA512: f5258d37043fcc9744f85641a60a3395ad43822c72d030dea8c39fa7f48ec3d7790cdeeb832f96e8f38046adb7c62fbc577c975ef0c77c8047c0c8f2353ce540
openstack-mirroring
pushed a commit
to openstack/openstack
that referenced
this pull request
Jul 10, 2024
* Update swift from branch 'master' to 9c38d756e0233eaa5f9e26066756eea9ce6a11ad - Merge "Use entry_points for server executables" - Use entry_points for server executables The old [files]scripts method of specifying executable Python scripts triggers some legacy easy-install-like mode for editable installs, which relies on pkg_resources. Recent versions of setuptools (67.5.0+) have started emitting warnings when importing pkg_resources, which in turn cause quite noticeable slowdowns in process startup. This is particularly prominant on py312, which stopped pre-installing (an often older version of) setuptools in new venvs. See also: - python/cpython#95299 - pypa/setuptools#3843 - pypa/setuptools#3966 Now, use [entry_points]console_scripts to specify these executables, which does not use pkg_resources in the generated script files. Change-Id: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
openstack-mirroring
pushed a commit
to openstack/swift
that referenced
this pull request
Jul 10, 2024
The old [files]scripts method of specifying executable Python scripts triggers some legacy easy-install-like mode for editable installs, which relies on pkg_resources. Recent versions of setuptools (67.5.0+) have started emitting warnings when importing pkg_resources, which in turn cause quite noticeable slowdowns in process startup. This is particularly prominant on py312, which stopped pre-installing (an often older version of) setuptools in new venvs. See also: - python/cpython#95299 - pypa/setuptools#3843 - pypa/setuptools#3966 Now, use [entry_points]console_scripts to specify these executables, which does not use pkg_resources in the generated script files. Change-Id: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
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 of changes
Closes
Pull Request Checklist
changelog.d/
.(See documentation for details)