-
Couldn't load subscription status.
- Fork 160
Python 3.13 compatibility. #473
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
Python 3.13 compatibility. #473
Conversation
Between Python 3.12 and Python 3.13, the internal structure of pathlib changed, causing the Artifactory URL parsing to fail. `pathlib.PurePath` previously had a private class attribute, `_flavour`, which has now been renamed to `parser` and made into a public and documented API. This renames `_flavour` to `parser` in the ArtifactoryPath subclasses, but it leaves around a `_flavour` class attribute that is aliased to `parser` as a compatibility shim for older versions of Python. One other breakage between Python 3.12 and 3.13 is that the artifactory package attempted to import `posixpath` via the `pathlib` package. `posixpath` was never meant to be a publicly accessible attribute of `pathlib`, as `posixpath` is its own top-level package in the standard library. The `pathlib` code was significantly restructured, causing the `posixpath` module to no longer be accessible under `pathlib`. We fix this in artifactory by directly importing the top-level `posixpath` package. Finally, this adds Python 3.13 to the package metadata in setup.py and the tox and GitHub Actions configuration files so that it is officially declared as a supported Python version and tested in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for PR!
Let's wait for the community feedback about the fix and we can merge it 🙏
pip install git+https://github.com/richardxia/artifactory@feature/python-3.13-pathlib-fixes
|
Thanks! This fixes the parsing issue. However, running a minimal script with a loop resulted in an AttributeError: from artifactory import ArtifactoryPath
path = ArtifactoryPath("https://mysite/artifactory")
for p in path:
print(path)Raises UpdateReplacing the call to |
|
@offa thank you for the fix! Could you create a PR to Let's have a dedicated branch, so we don't have to push in forks the hotfixes and we'll release it when it's stable for all! |
|
Thank you for the quick review! Really appreciate it! |
* Python 3.13 compatibility. (#473) Between Python 3.12 and Python 3.13, the internal structure of pathlib changed, causing the Artifactory URL parsing to fail. `pathlib.PurePath` previously had a private class attribute, `_flavour`, which has now been renamed to `parser` and made into a public and documented API. This renames `_flavour` to `parser` in the ArtifactoryPath subclasses, but it leaves around a `_flavour` class attribute that is aliased to `parser` as a compatibility shim for older versions of Python. One other breakage between Python 3.12 and 3.13 is that the artifactory package attempted to import `posixpath` via the `pathlib` package. `posixpath` was never meant to be a publicly accessible attribute of `pathlib`, as `posixpath` is its own top-level package in the standard library. The `pathlib` code was significantly restructured, causing the `posixpath` module to no longer be accessible under `pathlib`. We fix this in artifactory by directly importing the top-level `posixpath` package. Finally, this adds Python 3.13 to the package metadata in setup.py and the tox and GitHub Actions configuration files so that it is officially declared as a supported Python version and tested in CI. * Replace _make_child_relpath() with public joinpath() (#475) * Add unit test for `glob()` and partially fix Python 3.13 case. (#476) * Add unit test for `glob()` and partially fix Python 3.13 case. * Add custom subclass of _Globber to fix remaining issues with glob behavior. * Guard _globber override with Python version check. Co-authored-by: allburov <[email protected]> * Rearrange `if` statement to prefer early returns. Co-authored-by: allburov <[email protected]> * Add comment linking to original code for recursive_selector(). --------- Co-authored-by: allburov <[email protected]> --------- Co-authored-by: Richard Xia <[email protected]> Co-authored-by: offa <[email protected]>
Fixes #470.
Between Python 3.12 and Python 3.13, the internal structure of pathlib changed, causing the Artifactory URL parsing to fail.
pathlib.PurePathpreviously had a private class attribute,_flavour, which has now been renamed toparserand made into a public and documented API.This renames
_flavourtoparserin the ArtifactoryPath subclasses, but it leaves around a_flavourclass attribute that is aliased toparseras a compatibility shim for older versions of Python.One other breakage between Python 3.12 and 3.13 is that the artifactory package attempted to import
posixpathvia thepathlibpackage.posixpathwas never meant to be a publicly accessible attribute ofpathlib, asposixpathis its own top-level package in the standard library. Thepathlibcode was significantly restructured, causing theposixpathmodule to no longer be accessible underpathlib. We fix this in artifactory by directly importing the top-levelposixpathpackage.Finally, this adds Python 3.13 to the package metadata in setup.py and the tox and GitHub Actions configuration files so that it is officially declared as a supported Python version and tested in CI.