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

artifactory-du command fails in Python 3.13 #20

Closed
testworksau opened this issue Jan 31, 2025 · 2 comments
Closed

artifactory-du command fails in Python 3.13 #20

testworksau opened this issue Jan 31, 2025 · 2 comments

Comments

@testworksau
Copy link

In Python 3.13.1 on Mac OSX, installing and using artifactory-du in a new venv yields:

Traceback (most recent call last):
  File "/Users/testworksau/venvs/artifactorydu/bin/artifactory-du", line 5, in <module>
    from artifactory_du.artifactory_du import main
  File "/Users/testworksau/venvs/artifactorydu/lib/python3.13/site-packages/artifactory_du/artifactory_du.py", line 7, in <module>
    from artifactory import ArtifactoryPath
  File "/Users/testworksau/venvs/artifactorydu/lib/python3.13/site-packages/artifactory.py", line 429, in <module>
    class _ArtifactoryFlavour(object if IS_PYTHON_3_12_OR_NEWER else pathlib._Flavour):
    ...<178 lines>...
            return drv + root + part
  File "/Users/testworksau/venvs/artifactorydu/lib/python3.13/site-packages/artifactory.py", line 447, in _ArtifactoryFlavour
    pathmod = pathlib.posixpath
              ^^^^^^^^^^^^^^^^^
AttributeError: module 'pathlib' has no attribute 'posixpath'. Did you mean: 'PosixPath'?

Modifying this code:

class _ArtifactoryFlavour(object if IS_PYTHON_3_12_OR_NEWER else pathlib._Flavour):
    """
    Implements Artifactory-specific pure path manipulations.
    I.e. what is 'drive', 'root' and 'path' and how to split full path into
    components.
    See 'pathlib' documentation for explanation how those are used.

    drive: in context of artifactory, it's the base URI like
      http://mysite/artifactory

    root: like in unix, / when absolute, empty when relative

    path: relative artifact path within the repository
    """

    sep = "/"
    altsep = "/"
    has_drv = True
    pathmod = pathlib.posixpath
    is_supported = True

to the following:

class _ArtifactoryFlavour(object if IS_PYTHON_3_12_OR_NEWER else pathlib._Flavour):
    """
    Implements Artifactory-specific pure path manipulations.
    I.e. what is 'drive', 'root' and 'path' and how to split full path into
    components.
    See 'pathlib' documentation for explanation how those are used.

    drive: in context of artifactory, it's the base URI like
      http://mysite/artifactory

    root: like in unix, / when absolute, empty when relative

    path: relative artifact path within the repository
    """

    sep = "/"
    altsep = "/"
    has_drv = True
    pathmod = pathlib.PosixPath
    is_supported = True

resolves the issue for me.

pip3 list:

Package            Version
------------------ -----------
artifactory-du     1.0.5
certifi            2024.12.14
cffi               1.17.1
charset-normalizer 3.4.1
cryptography       44.0.0
decorator          5.1.1
dohq-artifactory   1.0.0
gssapi             1.9.0
hurry.filesize     0.9
idna               3.10
krb5               0.7.0
pip                25.0
pycparser          2.22
PyJWT              2.10.1
pyspnego           0.11.2
python-dateutil    2.9.0.post0
requests           2.32.3
requests-kerberos  0.15.0
semantic-version   2.10.0
setuptools         75.8.0
setuptools-rust    1.10.2
six                1.17.0
urllib3            2.3.0
@allburov allburov changed the title artifactory-du command fails in Python 3. artifactory-du command fails in Python 3.13 Jan 31, 2025
@allburov
Copy link
Member

Try using python 3.12, python 3.13 is not supported by artifactory lib yet
devopshq/artifactory#470

Closing the issue because there's nothing to fix in the repo

@allburov
Copy link
Member

fill free to open PR with the fix to https://github.com/devopshq/artifactory 👍

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

No branches or pull requests

2 participants