Skip to content

Commit 53eae02

Browse files
authored
Support python 3.13 (#275)
* nox: add 3.13 session * tests: xfail unsupported access to private attrs _drv, _root, _parts * upath.core: add parser alias for _flavour * upath.core: replace _make_child_relpath usage in iterdir * ci: add 3.13 to tests * upath: update classifier in package metadata * tests: don't install moto on 3.13 windows for now (skips s3 windows tests) * upath: prevent pywin32 installation on windows 3.13 until release available
1 parent b03e845 commit 53eae02

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
os: [ubuntu-20.04, windows-latest, macos-latest]
24-
pyv: ['3.8', '3.9', '3.10', '3.11', '3.12']
24+
pyv: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
2525
fsspec: ['']
2626

2727
include:
@@ -41,6 +41,7 @@ jobs:
4141
PIP_DISABLE_PIP_VERSION_CHECK: ${{ matrix.pyv == '3.8' && matrix.os == 'macos-latest' }}
4242
with:
4343
python-version: ${{ matrix.pyv }}
44+
allow-prereleases: true
4445

4546
- name: Upgrade pip and nox
4647
run: |

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
locations = ("upath",)
1111

1212

13-
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9"])
13+
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"])
1414
def tests(session: nox.Session) -> None:
1515
# workaround in case no aiohttp binary wheels are available
1616
session.env["AIOHTTP_NO_EXTENSIONS"] = "1"

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ classifiers = [
2424
"Programming Language :: Python :: 3.10",
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2728
"Development Status :: 4 - Beta",
2829
]
2930
keywords = ["filesystem-spec", "pathlib"]
@@ -44,12 +45,13 @@ tests = [
4445
"packaging",
4546
]
4647
dev = [
47-
"adlfs",
48+
"adlfs; python_version<='3.12' or (python_version>'3.12' and os_name!='nt') ",
4849
"aiohttp",
4950
"requests",
5051
"gcsfs",
5152
"s3fs",
52-
"moto[s3,server]",
53+
# exclude moto installation on 3.13 windows until pywin32 wheels are available:
54+
"moto[s3,server]; python_version<='3.12' or (python_version>'3.12' and os_name!='nt') ",
5355
"webdav4[fsspec]",
5456
"paramiko",
5557
"wsgidav",

upath/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ def with_suffix(self, suffix: str) -> Self: ...
135135
_protocol_dispatch: bool | None = None
136136
_flavour = LazyFlavourDescriptor()
137137

138+
if sys.version_info >= (3, 13):
139+
parser = _flavour
140+
138141
# === upath.UPath constructor =====================================
139142

140143
def __new__(
@@ -868,7 +871,7 @@ def iterdir(self) -> Generator[UPath, None, None]:
868871
continue
869872
# only want the path name with iterdir
870873
_, _, name = str_remove_suffix(name, "/").rpartition(self._flavour.sep)
871-
yield self._make_child_relpath(name)
874+
yield self.with_segments(*self.parts, name)
872875

873876
def _scandir(self):
874877
raise NotImplementedError # todo

upath/tests/cases.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ def test_read_with_fsspec(self):
532532
with fs.open(path) as f:
533533
assert f.read() == b"hello world"
534534

535+
@pytest.mark.xfail(
536+
sys.version_info >= (3, 13),
537+
reason="no support for private `._drv`, `._root`, `._parts` in 3.13",
538+
)
535539
def test_access_to_private_api(self):
536540
# DO NOT access these private attributes in your code
537541
p = UPath(str(self.path), **self.path.storage_options)

0 commit comments

Comments
 (0)