-
-
Notifications
You must be signed in to change notification settings - Fork 223
revise importing on python 3.9 + bugfixes #1152
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
Conversation
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.
Pull Request Overview
This PR revises the importing mechanism for Python 3.9 by removing the importlib-metadata dependency and implementing a simpler shim for handling entry points across different Python versions.
- Removes importlib-metadata dependency from project dependencies
- Implements version-specific entry_points functions to handle API differences between Python 3.9 and 3.10+
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/setuptools_scm/_entrypoints.py | Implements version-specific entry_points functions and removes importlib_metadata import |
pyproject.toml | Removes importlib-metadata dependency for Python < 3.10 |
Comments suppressed due to low confidence (2)
src/setuptools_scm/_entrypoints.py:34
- The variable 'im' is not defined in the Python 3.9 branch. Since the top-level import was removed, this branch needs its own import statement for importlib_metadata.
eps = im.entry_points() # Returns dict
src/setuptools_scm/_entrypoints.py:43
- This import shadows the module-level 'im' import and creates inconsistent behavior. The function should use a different variable name or rely on the module-level import.
import importlib.metadata as im
else: | ||
from importlib import metadata as im | ||
|
||
from importlib import metadata as im |
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.
This import will fail on Python 3.9 since importlib.metadata doesn't have the same API as importlib_metadata. The code should only import this for Python 3.10+ or handle the ImportError.
Copilot uses AI. Check for mistakes.
4039b13
to
45ed1cb
Compare
…contex - prevent failures around midnight in non-UTC timezones - Update `meta` function to accept a time parameter for consistent behaviour in tests
reintroduces the shim in a simpler way
closes #1145
addresses python/importlib-metadata#515
closes #687