Skip to content

Python 3.14 compatibility#491

Open
Valentin-Sarthou wants to merge 1 commit intodevopshq:masterfrom
Valentin-Sarthou:vsa/python_314_support
Open

Python 3.14 compatibility#491
Valentin-Sarthou wants to merge 1 commit intodevopshq:masterfrom
Valentin-Sarthou:vsa/python_314_support

Conversation

@Valentin-Sarthou
Copy link

Hello,
I encountered an error when trying to use this module with Python 3.14, and I tried to suggest the appropriate changes in this PR.

Copy link
Member

@allburov allburov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@allburov
Copy link
Member

TypeError: PurePath.init() got an unexpected keyword argument 'auth'

Tests for py 3.14 failed 🤔

Between Python 3.13 and Python 3.14:
- glob._Globber was renamed to glob._GlobberBase
- Support for passing keyword arguments to pathlib.Path has been removed

Guard changes with Python 3.14 version check.
@Valentin-Sarthou
Copy link
Author

It seems that many changes have been made to pathlib between Python 3.13 and 3.14 (python/cpython@f5ba74b), which seems to make the changes done in 32cdad0 irrelevant with Python 3.14, especially these lines:

artifactory/artifactory.py

Lines 1898 to 1905 in 32cdad0

def glob(self, *args, **kwargs):
if IS_PYTHON_3_13_OR_NEWER:
# In Python 3.13, the implementation of Path.glob() changed such that it assumes that it
# works only with real filesystem paths and will try to call real filesystem operations like
# os.scandir(). In Python 3.13, we explicitly intercept this and call PathBase's glob()
# implementation, which only depends on methods defined on the Path subclass.
return pathlib._abc.PathBase.glob(self, *args, **kwargs)
return super().glob(*args, **kwargs)

pathlib._abc.PathBase has been removed and kind of replaced by pathlib.types._ReadablePath, but I don't think _ReadablePath.glob() is a good replacement because it uses a hardcoded globber class _PathGlobber:
https://github.com/python/cpython/blob/7cafd76a7fc6e52d93dd11e454a49c4dbebdf080/Lib/pathlib/types.py#L300-L314

The _globber attribute has been removed anyway in python/cpython@f5ba74b, which makes the following lines also irrelevant with Python 3.14:

artifactory/artifactory.py

Lines 1599 to 1603 in 32cdad0

# In Python 3.13, this attribute is accessed by PurePath.glob(), and we need to
# override it to behave properly for ArtifactoryPaths with a custom subclass of
# glob._Globber.
if IS_PYTHON_3_13_OR_NEWER:
_globber = _ArtifactoryGlobber

@allburov I'm not sure what's the best approach here, so maybe I'll leave this to you.

@sverrehu
Copy link

Would love to see this fix reach artifactory-cleanup. :-)

@mikaelol
Copy link

Related issue #492

@Mrizwanshaik
Copy link

Mrizwanshaik commented Dec 15, 2025

Hello, We are also using this package for our artifactory tasks and currently affected. Can you please update when this will be merged and release?

@allburov
Copy link
Member

@Mrizwanshaik have you tested the PR for you case, does it work?

I'll leave this to you

It is a problem 😆 I'm happy to review and merge PR but don't have much time to investigate the issue 😢

@Mrizwanshaik
Copy link

@allburov

don't have much time to investigate the issue

Issue: Our bot is trying to bump python container to 3.14 in github workflow and we use the dohq-artifactory artifactory client package, which is currently not supported due to which validation is failing.

have you tested the PR for you case, does it work?

Yes I have tested the PR and it does work.

@Mrizwanshaik
Copy link

@allburov any update on this PR to merge?

@axel-kah
Copy link

As @Valentin-Sarthou mentioned, this PR needs more work. Tried it with the latest commit (Valentin-Sarthou@ec64a43) and failed when using glob().

Boiled it down to this repro:

# /// script
# requires-python = "==3.14.*"
# dependencies = [
#     "dohq-artifactory @ git+https://github.com/Valentin-Sarthou/artifactory.git@ec64a43",
# ]
# ///

import os
import sys
from artifactory import ArtifactoryPath

print(f"Python version: {sys.version}")

token = os.environ["ARTIFACTORY_TOKEN"]
arti_baseurl = "https://acme.com/artifactory/"
repo_name = "some-local-repo"

deployment_url = f"{arti_baseurl}/{repo_name}"

artifact_repo = ArtifactoryPath(deployment_url, apikey=token)
already_deployed = artifact_repo.glob("*")

print(f"Artifacts in repo {repo_name}:")
for idx, artifact in enumerate(already_deployed):
    print(f"- {artifact.name}")

Triggering the issue:

uv run --script dohq-artifactory-3-14-issue.py --no-cache
Installed 9 packages in 92ms
Python version: 3.14.2 (main, Jan 14 2026, 19:31:25) [MSC v.1944 64 bit (AMD64)]
Traceback (most recent call last):
  File "C:\dev\dohq-artifactory-3-14-issue.py", line 21, in <module>
    already_deployed = artifact_repo.glob("*")
  File "C:\Users\john\AppData\Local\uv\cache\environments-v2\dohq-artifactory-3-14-issue-e172a37c5810a5df\Lib\site-packages\artifactory.py", line 1910, in glob
    return pathlib._abc.PathBase.glob(self, *args, **kwargs)
           ^^^^^^^^^^^^
AttributeError: module 'pathlib' has no attribute '_abc'

@offa
Copy link
Contributor

offa commented Feb 6, 2026

glob() is broken because _abc no longer exists on Python 3.14:

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.

7 participants

Comments