diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1c6c67e5..d30c1d44 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, windows-latest, macos-latest] - pyv: ['3.8', '3.9', '3.10', '3.11', '3.12'] + pyv: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] fsspec: [''] include: @@ -41,6 +41,7 @@ jobs: PIP_DISABLE_PIP_VERSION_CHECK: ${{ matrix.pyv == '3.8' && matrix.os == 'macos-latest' }} with: python-version: ${{ matrix.pyv }} + allow-prereleases: true - name: Upgrade pip and nox run: | diff --git a/noxfile.py b/noxfile.py index 485c9d32..63d3ed2c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,7 +10,7 @@ locations = ("upath",) -@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9"]) +@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]) def tests(session: nox.Session) -> None: # workaround in case no aiohttp binary wheels are available session.env["AIOHTTP_NO_EXTENSIONS"] = "1" diff --git a/pyproject.toml b/pyproject.toml index d6ee777f..54b638e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Development Status :: 4 - Beta", ] keywords = ["filesystem-spec", "pathlib"] @@ -44,12 +45,13 @@ tests = [ "packaging", ] dev = [ - "adlfs", + "adlfs; python_version<='3.12' or (python_version>'3.12' and os_name!='nt') ", "aiohttp", "requests", "gcsfs", "s3fs", - "moto[s3,server]", + # exclude moto installation on 3.13 windows until pywin32 wheels are available: + "moto[s3,server]; python_version<='3.12' or (python_version>'3.12' and os_name!='nt') ", "webdav4[fsspec]", "paramiko", "wsgidav", diff --git a/upath/core.py b/upath/core.py index 45efd609..2003fa95 100644 --- a/upath/core.py +++ b/upath/core.py @@ -135,6 +135,9 @@ def with_suffix(self, suffix: str) -> Self: ... _protocol_dispatch: bool | None = None _flavour = LazyFlavourDescriptor() + if sys.version_info >= (3, 13): + parser = _flavour + # === upath.UPath constructor ===================================== def __new__( @@ -868,7 +871,7 @@ def iterdir(self) -> Generator[UPath, None, None]: continue # only want the path name with iterdir _, _, name = str_remove_suffix(name, "/").rpartition(self._flavour.sep) - yield self._make_child_relpath(name) + yield self.with_segments(*self.parts, name) def _scandir(self): raise NotImplementedError # todo diff --git a/upath/tests/cases.py b/upath/tests/cases.py index f539c6d3..6c9b914d 100644 --- a/upath/tests/cases.py +++ b/upath/tests/cases.py @@ -532,6 +532,10 @@ def test_read_with_fsspec(self): with fs.open(path) as f: assert f.read() == b"hello world" + @pytest.mark.xfail( + sys.version_info >= (3, 13), + reason="no support for private `._drv`, `._root`, `._parts` in 3.13", + ) def test_access_to_private_api(self): # DO NOT access these private attributes in your code p = UPath(str(self.path), **self.path.storage_options)