-
Notifications
You must be signed in to change notification settings - Fork 158
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 #470
Comments
While the posixpath issue is fixed very easily, the issues that follow are more complicated. --- a/artifactory.py
+++ b/artifactory.py
@@ -33,6 +33,7 @@ import json
import os
import pathlib
import platform
+import posixpath
import re
import urllib.parse
from itertools import chain
@@ -444,7 +445,7 @@ class _ArtifactoryFlavour(object if IS_PYTHON_3_12_OR_NEWER else pathlib._Flavou
sep = "/"
altsep = "/"
has_drv = True
- pathmod = pathlib.posixpath
+ pathmod = posixpath
is_supported = True
def _get_base_url(self, url): (The underlying issue here is the changed pathlib API, Using this minimal example: from artifactory import ArtifactoryPath
path = ArtifactoryPath("https://mysite/artifactory")
print(path) I get correct results on Python <= 3.12:
but a broken path on Python 3.13:
This causes invalid URLs on subsequent usages, which eventually end in a type error ("TypeError: must be str, not NoneType"; see below) Running this projects tests on Python 3.13 confirms broken paths and/or resulting errors:
|
I did some further debugging, and figured out why the URL parsing is now broken under Python 3.13, and I also have a very small patch that will get the artifactory unit tests passes. It looks like between Python 3.12 and 3.13, a couple of patches12 ended up renaming the private From what I can understand from the artifactory codebase, the The issue is that when Python renamed A really quick and dirty fix is to just simultaneously define diff --git a/artifactory.py b/artifactory.py
index 0c4b63c..7c440c6 100755
--- a/artifactory.py
+++ b/artifactory.py
@@ -33,6 +33,7 @@ import json
import os
import pathlib
import platform
+import posixpath
import re
import urllib.parse
from itertools import chain
@@ -444,7 +445,7 @@ class _ArtifactoryFlavour(object if IS_PYTHON_3_12_OR_NEWER else pathlib._Flavou
sep = "/"
altsep = "/"
has_drv = True
- pathmod = pathlib.posixpath
+ pathmod = posixpath
is_supported = True
def _get_base_url(self, url):
@@ -1500,6 +1501,7 @@ class PureArtifactoryPath(pathlib.PurePath):
"""
_flavour = _artifactory_flavour
+ parser = _flavour
__slots__ = ()
def _init(self, *args):
@@ -2662,6 +2664,7 @@ class ArtifactorySaaSPath(ArtifactoryPath):
"""Class for SaaS Artifactory"""
_flavour = _saas_artifactory_flavour
+ parser = _flavour
class ArtifactoryBuild: When I have that patch applied locally, it allows the unit tests to pass on Python 3.13. I think it should be safe to have both aliased attributes defined, since each version of Python will only look at the attribute it cares about. I can prepare a pull request with these changes, and we can discuss there whether we want to make any tweaks to it. Footnotes
|
Hi! Thank you for PR! Let's wait for the community feedback about the fix and we can merge it 🙏
|
Feature branch for Python 3.13 support: https://github.com/devopshq/artifactory/tree/python-3-13 |
Works for me on 3.13 - cheers! |
I just tried it. Although I am not getting the attribute error, |
With #463 the library works on Python 3.12 (#430), but not on Python 3.13 yet:
Reported location
Tested using
master
at 46728f6.The text was updated successfully, but these errors were encountered: