Skip to content

Conversation

RonnyPfannschmidt
Copy link
Contributor

@RonnyPfannschmidt RonnyPfannschmidt commented Jul 23, 2025

reintroduces the shim in a simpler way

closes #1145
addresses python/importlib-metadata#515
closes #687

Copy link

@Copilot Copilot AI left a 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
Copy link

Copilot AI Jul 23, 2025

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.

@RonnyPfannschmidt RonnyPfannschmidt changed the title revise importing on python 3.9 revise importing on python 3.9 + bugfixes Jul 24, 2025
…contex

- prevent failures around midnight in non-UTC timezones
- Update `meta` function to accept a time parameter for consistent behaviour in tests
@RonnyPfannschmidt RonnyPfannschmidt merged commit 8ac404a into pypa:main Jul 24, 2025
20 checks passed
@RonnyPfannschmidt RonnyPfannschmidt deleted the revise branch July 24, 2025 17:23
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.

testing/test_git.py::test_git_getdate does not work on systems with non-UTC timezone test_calver_by_date fails in 6.4.2

1 participant