Skip to content
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

Add Python 3.12 to the test matrix #814

Closed
machawk1 opened this issue Nov 8, 2023 · 8 comments · Fixed by #846
Closed

Add Python 3.12 to the test matrix #814

machawk1 opened this issue Nov 8, 2023 · 8 comments · Fixed by #846

Comments

@machawk1
Copy link
Member

machawk1 commented Nov 8, 2023

Released October 2, 2023 though its availability in the GitHub Actions test suite is TBD.

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

Per the Python 3.12 release notes, pkg_resources is no longer installed by default in virtual environments in addition to the absence of distutils, setuptools, and easy_install (see python/cpython#95299). ipwb uses this in testing, particular in test_backends.py. These can be installed via pip install setuptools once the venv has been activated.

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

The testing GH Action reports, "from six.moves.urllib_parse import urlsplit, urlunsplit" only for Python 3.12. six ought to be removed and its usage adapted to Python 3 built-in modules if possible, as ipwb no longer supports Python 2.

EDIT: see #816 for the above effort.

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

/Users/runner/work/ipwb/ipwb/ipwb/util.py:27: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

  • Identify and implement an alternative to pkg_resources for Python 3.12 support.

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

parse_version() within pkg_resources is the issue here. An alternative to obtain the package version is importlib.metadata import version but that does not split the version based on sortable keys, as did parse_version()

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

The main reason for this check was to send a communicate with the IPFS daemon differently if its version was < 0.4.10, which is far from supported by ipwb. Regardless, it is useful to have this logic to check for a supported version of the daemon to ensure commands from ipwb will be processed predictably.

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

An alternative can be had in the packaging external module.

from packaging.version import parse, Version
parse("1.1.1") < parse("1.2")

@machawk1
Copy link
Member Author

machawk1 commented Nov 8, 2023

Another substitute from replay.py is the need for replacing:

index_file_name = pkg_resources.resource_filename(__name__, index_file_path)

with the equivalent from
importlib.resources

machawk1 added a commit that referenced this issue Apr 24, 2024
machawk1 added a commit that referenced this issue Apr 24, 2024
@machawk1 machawk1 mentioned this issue Oct 16, 2024
1 task
@machawk1
Copy link
Member Author

We likely don't need to assert the function with assert in the name. That might be the solution to the testing reporting a comparison with None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant