recast-hep / recast-atlas

CLI for ATLAS RECAST contributors
https://recast.docs.cern.ch/
Apache License 2.0
7 stars 5 forks source link

Add support for Python 3.12 #137

Closed matthewfeickert closed 3 months ago

matthewfeickert commented 3 months ago

pkg_resources is deprecated and removed in Python 3.12:

Python 3.12 has removed pkg_resources from the standard library (moved to setuptools): https://docs.python.org/3/whatsnew/3.12.html

setuptools docs: Package Discovery and Resource Access using pkg_resources

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.

Currently (ebc66fd54778e13409a0966004e6d4266f79f8d0) used in src/recastatlas/config.py, src/recastatlas/subcommands/catalogue.py, and src/recastatlas/subcommands/auth.py, and so needs to be removed.

At the moment recast-atlas is only testing and supporting up to Python 3.11:

https://github.com/recast-hep/recast-atlas/blob/ebc66fd54778e13409a0966004e6d4266f79f8d0/.github/workflows/ci.yml#L22

https://github.com/recast-hep/recast-atlas/blob/ebc66fd54778e13409a0966004e6d4266f79f8d0/setup.cfg#L16-L22

matthewfeickert commented 3 months ago

First raised in https://atlas-talk.web.cern.ch/t/pip-installation-of-recast-atlas/44644/

matthewfeickert commented 3 months ago

PRs like https://github.com/recast-hep/recast-atlas/pull/139 also need to get fixed in all of the yadage ecosystem too before a Python 3.12 compliant recast-atlas can be made.

=============================== warnings summary ===============================
../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/yadageschemas/__init__.py:2
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/yadageschemas/__init__.py:2: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pkg_resources/__init__.py:2825
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pkg_resources/__init__.py:2825: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('ruamel')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/reana_client/api/client.py:10
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/reana_client/api/client.py:10: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    import cgi

../../../../../opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/yadage/handlers/expression_handlers.py:60
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/yadage/handlers/expression_handlers.py:60: DeprecationWarning: invalid escape sequence '\ '
    "found multiple matches to query: %s within result: %s\n \ matches %s",

tests/test_cli.py::test_run_hello_world
  /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/glob2/fnmatch.py:141: DeprecationWarning: invalid escape sequence '\Z'
    return '(?ms)' + res + '\Z'

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
matthewfeickert commented 3 months ago

Resolved by PR #141

matthewfeickert commented 3 months ago

Reported the cgi DeprecationWarning in https://github.com/reanahub/reana-client/issues/717.