Skip to content

Comments

Fixes to work with Python 3.12+#254

Open
bje- wants to merge 3 commits intoklen:developfrom
bje-:develop
Open

Fixes to work with Python 3.12+#254
bje- wants to merge 3 commits intoklen:developfrom
bje-:develop

Conversation

@bje-
Copy link

@bje- bje- commented Jun 21, 2024

This patch removes the dependence on pkg_resources which is not available by default in Python 3.12 and beyond. It switches from pkg_resources.iter_entry_points to import_metadata.entry_points. import_metadata is available in all supported versions of Python.

The other change removes the use of parse_requirements and just hardcodes the package dependencies in setup.py, which is arguably good practice anyway since not all developer-installed packages are required by the installation.

Finally, setuptools is added to requirements.txt since it is also no longer installed by default with Python 3.12.

- Eliminate the use of pkg_resources which is no longer installed with
  Python 3.12 and greater.

- Add setuptools to requirements.txt which is no longer included in
  Python distributions (>= 3.12).
@bje-
Copy link
Author

bje- commented Apr 9, 2025

Ping?

@bje-
Copy link
Author

bje- commented Jun 8, 2025

Can this PR be merged, please?

@Famlam
Copy link

Famlam commented Jun 8, 2025

Maybe ping @klen in case it went unnoticed

It seems that even installing setuptools manually will stop working soon

UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.

@mshonichev
Copy link

ping @klen :)

Can this PR be merged, please, it's very annoying to suppress warnings in CI and it freaks me out that pylama would stop working after CI pipelines upgrade to python 3.12

Copy link

@b-layer b-layer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about import_metadata (with underscore)? Not found for me when I merged this locally. Docs say import.metadata (with period) and that works. (Python 3.12.12)

@cjwatson
Copy link

Are you sure about import_metadata (with underscore)? Not found for me when I merged this locally. Docs say import.metadata (with period) and that works. (Python 3.12.12)

importlib_metadata does exist as a backport, but at this point there's no reason to use it any more; all supported Python versions have importlib.metadata in the stdlib. It might be worth explicitly declaring a new enough python_requires.

@bje-
Copy link
Author

bje- commented Jan 29, 2026

importlib_metadata does exist as a backport, but at this point there's no reason to use it any more; all supported Python versions have importlib.metadata in the stdlib. It might be worth explicitly declaring a new enough python_requires.

I've updated the PR.

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.

5 participants