python-license-check icon indicating copy to clipboard operation
python-license-check copied to clipboard

Support Python 3.12

Open rad-pat opened this issue 1 year ago • 3 comments

With Python 3.12 the following error is encountered:

  Traceback (most recent call last):
    File "/opt/hostedtoolcache/Python/3.12.2/x64/bin/liccheck", line 5, in <module>
      from liccheck.command_line import main
    File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/liccheck/command_line.py", line 5, in <module>
      from liccheck.requirements import parse_requirements, resolve, resolve_without_deps
    File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/liccheck/requirements.py", line 1, in <module>
      import pkg_resources
  ModuleNotFoundError: No module named 'pkg_resources'

https://github.com/dhatim/python-license-check/issues/114 covers the same error as a deprecation warning, but full support should be given to Python 3.12

rad-pat avatar Mar 06 '24 16:03 rad-pat

This is quite the necessary upgrade if we want to keep using liccheck.

@rad-pat do you know what changes must be done, maybe you can point me to them? Then I can try to open a PR myself.

albertodiazdorado avatar Jan 02 '25 12:01 albertodiazdorado

@albertodiazdorado , according to https://docs.python.org/3/whatsnew/3.12.html, pkg_resources should be available if setuptools is installed as requirement, which is essentially what https://github.com/dhatim/python-license-check/pull/113 is doing. I'm not sure why tests failed for that PR.

rad-pat avatar Jan 02 '25 14:01 rad-pat

This warning suggests that relying on pkg_resources via setuptools may not be a lasting workaround. I get the warning when running liccheck in a project with Python 3.11.9 and an explicit dependency on setuptools

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.

Stigjb avatar Sep 25 '25 12:09 Stigjb