-
Notifications
You must be signed in to change notification settings - Fork 14k
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
refactor: pkg_resources -> importlib.metadata #24514
Conversation
12cbd8f
to
bed765e
Compare
bed765e
to
3eb7eaf
Compare
3eb7eaf
to
7f964b3
Compare
Thanks @cwegener for the PR. Note you'll also have to re-compile the Python dependencies which ensures we have a frozen set of Python packages (and sub-packages) for testing purposes. Please refer to the CONTRIBUTING.md file with regards to how to do this. |
Hi John. I tried, but pip-compile-multi seems to just blissfully ignore the install_dependencies from setup.py Do you have any hints on how to make pip-compile-multi read the install_dependencies collection from setup.py? |
@cwegener I gather you mean |
Sorry, yes. Typo. |
pkg_resources is in the process of being deprecated in favor of importlib.metadata and importlib.resources importlib.metadata has been available in the standard library since 3.8 And as of 3.10 the importlib.metadata API is no longer provisional In order to support Python version older than 3.10, the `importlib_metadata` backport is used instead of the actual `importlib.metadata` API.
7f964b3
to
7a9ec03
Compare
I did just force push the 'noop' result from pip-compile-multi, which is basically just adding the comment into the requirements/base.txt for good measure. |
@@ -137,7 +137,9 @@ humanize==3.11.0 | |||
idna==3.2 | |||
# via email-validator | |||
importlib-metadata==6.6.0 | |||
# via flask | |||
# via | |||
# apache-superset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
On a different note, once I'm done with this |
Codecov Report
@@ Coverage Diff @@
## master #24514 +/- ##
==========================================
+ Coverage 69.06% 69.07% +0.01%
==========================================
Files 1901 1903 +2
Lines 74019 74027 +8
Branches 8116 8118 +2
==========================================
+ Hits 51121 51136 +15
+ Misses 20787 20780 -7
Partials 2111 2111
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@john-bodley Sorry about the missing import sort. I just pushed the fix for that. Can you run the GH actions again. |
@cwegener with regards to,
it might make sense to first create an issue (or possibly a SIP dependency on the complexity) regarding your intentions as it's probably worth discussing the pros/cons especially given the slew of Python package managers floating around. |
@cwegener after rereading your PR description you mention that,
and given we only support Python 3.9+ I was wondering why we need to use the backport. |
The backport is needed because the API of Specifically, the |
The best I can tell, the 'select' feature wasn't there in the I did just see though that there also is a more specific backport of JUST the select feature for entry_points() 😁 https://github.com/jaraco/backports.entry_points_selectable |
(Part 1 of 2) setuptools' pkg_resources is in the process of being deprecated in favor of importlib.resources and importlib.metadata (see also PR apache#24514) importlib.resources has been available in the standard library since Python 3.7 This change follows the importlib_resources migration guide and does not perform any additional refactoring. The last component that is using pkg_resources is 'superset.config.BASE_DIR' 'superset.config.BASE_DIR' is mainly used as the default file upload directory in Flask and therefore requires special attention as this directory needs to be writable and needs to exist for the full lifetime of the Flask application.
pkg_resources is in the process of being deprecated in favor of
importlib.metadata and importlib.resources
importlib.metadata has been available in the standard library since 3.8
And as of 3.10 the importlib.metadata API is no longer provisional
In order to support Python version older than 3.10, the
importlib_metadata
backport is used instead of the actualimportlib.metadata
API.