Skip to content

Conversation

@offa
Copy link
Contributor

@offa offa commented Feb 21, 2025

Python 3.13 compatibility (#470, #474): Fixes the AttributeError mentioned in #473.

With this change I got my example working on Python 3.13 to 3.9 👍.

@allburov allburov merged commit 9a6d1bc into devopshq:python-3-13 Feb 21, 2025
6 checks passed
@allburov
Copy link
Member

One step closer to Python 3.13, thanks! 🎉

@offa offa deleted the for_py313 branch February 21, 2025 09:53
allburov added a commit that referenced this pull request Apr 8, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants