Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b73214b
upath.core: move to ReadablePath and WriteablePath
ap-- May 5, 2025
75e91e8
upath.implementations.local: implement local paths
ap-- May 5, 2025
3047c7a
upath.implementations.http: fix __str__
ap-- May 5, 2025
320c399
upath.implementations.cloud: fix s3 tests
ap-- May 6, 2025
aa25c55
tests: remove obsolete skipped test
ap-- May 6, 2025
9159995
upath.core: fix __str__ implementation
ap-- May 6, 2025
a1c1a76
upath.core: allow iterdir to skip trailing slash dirs
ap-- May 6, 2025
98cd131
nox: output pip freeze in ci
ap-- May 6, 2025
e518419
upath.core: implement open dunders directly
ap-- May 6, 2025
63f3c6f
upath.implementations.data: fix data path
ap-- May 6, 2025
46566dd
upath.implementations.smb: fix parts parsing
ap-- May 6, 2025
6a02ef9
upath.implementations.sftp: fix parts parsing on join
ap-- May 6, 2025
4c4761b
upath.implementations.memory: fix memory path errors
ap-- May 6, 2025
1e0f978
upath.implementations.http: fix http path implementation
ap-- May 6, 2025
12c2787
tests: move http normalization to http tests
ap-- May 6, 2025
b5243f8
tests: remove deprecated and label joinpath as xfail
ap-- May 6, 2025
54edef5
tests: change class tree for upath
ap-- May 6, 2025
11ac5ad
upath.implementations.local: fix LocalPaths on 3.9-3.11
ap-- May 6, 2025
1bb011c
upath.types: walk is only available on 3.12
ap-- May 6, 2025
b4e43d6
upath.implementations.http: fix http path resolve behaviour
ap-- May 6, 2025
2df837b
upath.implementations.webdav: fix webdav impl
ap-- May 7, 2025
8c2b663
upath.implementations.http: fix iterdir bug on python <= 3.9.13
ap-- May 7, 2025
aafb729
upath: raise minimum required fsspec version
ap-- May 7, 2025
6d1d829
upath.implementations.local: fix windows tests
ap-- May 7, 2025
016a68a
upath.implementations.local: fix morewindows tests
ap-- May 7, 2025
b6c584b
upath.implementations.local: correctly throw ValueError on incompatib…
ap-- May 7, 2025
f459053
upath: make mypy checks pass initially
ap-- May 8, 2025
c4b2fc4
upath: typing related cleanups
ap-- May 8, 2025
ea75256
upath.types: fix pathlib_abc stubs
ap-- May 8, 2025
1915a2e
typesafety: adjust tests to new UPath interface
ap-- May 8, 2025
93159e9
upath: remove obsolete compat code
ap-- May 8, 2025
19e0f33
upath: fix potential __slots__ collision on 3.14
ap-- May 8, 2025
ccf9da5
upath.implementations.http: fix typing.Self import
ap-- May 8, 2025
456dd4a
run the type_safety checks against all versions
ap-- May 8, 2025
4b70d22
ci: run all typesafety checks
ap-- May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ max-complexity = 15
select = B,C,E,F,W,T4,B902,T,P
show_source = true
count = true
per-file-ignores =
upath/__init__.py: F401
exclude =
.noxfile,
.nox,
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: |
3.9
3.10
3.11
3.12
3.13

- name: Install nox
run: python -m pip install --upgrade nox
Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,15 +645,7 @@ installation of a newer version of its upstream dependencies. Below you can find
a list of known issues and their solutions. We attempt to keep this list updated
whenever we encounter more:

- **UPath().glob()**:
`fsspec` fixed glob behavior when handling `**` patterns in `fsspec>=2023.9.0`
- **GCSPath().mkdir()**:
a few mkdir quirks are solved by installing `gcsfs>=2022.7.1`
- **fsspec.filesystem(WebdavPath().protocol)**
the webdav protocol was added to fsspec in version `fsspec>=2022.5.0`
- **stat.S_ISDIR(HTTPPath().stat().st_mode)**
requires `fsspec>=2024.2.0` to correctly return `True` for directories

- currently none :sparkles:

## Contributing

Expand Down
10 changes: 6 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = "lint", "tests"
locations = ("upath",)
hide_pip_install = os.environ.get("CI", "") == ""
running_in_ci = os.environ.get("CI", "") != ""


@nox.session(python=["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"
session.install(".[tests,dev]", silent=hide_pip_install)
session.install(".[tests,dev]")
session.run("python", "-m", "pip", "freeze", silent=not running_in_ci)
session.run(
"pytest",
"-m",
Expand All @@ -29,7 +30,8 @@ def tests(session: nox.Session) -> None:

@nox.session(python="3.9", name="tests-minversion")
def tests_minversion(session: nox.Session) -> None:
session.install("fsspec==2022.1.0", ".[tests,dev]")
session.install("fsspec==2024.5.0", ".[tests,dev]")
session.run("python", "-m", "pip", "freeze", silent=not running_in_ci)
session.run(
"pytest",
"-m",
Expand Down Expand Up @@ -92,7 +94,7 @@ def type_checking(session):
session.run("python", "-m", "mypy")


@nox.session
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
def typesafety(session):
session.install("-e", ".[tests]")
session.run(
Expand Down
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ maintainers = [
]
requires-python = ">=3.9"
dependencies = [
"fsspec >=2022.1.0,!=2024.3.1",
"fsspec >=2024.5.0",
"pathlib-abc ==0.4.3",
]
classifiers = [
Expand Down Expand Up @@ -45,11 +45,11 @@ tests = [
"packaging",
]
dev = [
"adlfs",
"adlfs>=2024",
"aiohttp",
"requests",
"gcsfs>=2022.1.0",
"s3fs>=2022.1.0",
"gcsfs>=2024.5.0",
"s3fs>=2024.5.0",
"moto[s3,server]",
"webdav4[fsspec]",
"paramiko",
Expand Down Expand Up @@ -164,6 +164,10 @@ ignore_missing_imports = true
module = "pathlib_abc.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "smbprotocol.*"
ignore_missing_imports = true

[tool.pylint.format]
max-line-length = 88

Expand Down
30 changes: 6 additions & 24 deletions typesafety/test_upath_interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
from upath import UPath

p = UPath("abc")
reveal_type(p.parts) # N: Revealed type is "builtins.tuple[builtins.str, ...]"
reveal_type(p.parts) # N: Revealed type is "typing.Sequence[builtins.str]"

- case: upath_drive
disable_cache: false
Expand Down Expand Up @@ -294,14 +294,14 @@
main: |
from upath import UPath

reveal_type(UPath("abc").glob("efg")) # N: Revealed type is "typing.Generator[upath.core.UPath, None, None]"
reveal_type(UPath("abc").glob("efg")) # N: Revealed type is "typing.Iterator[upath.core.UPath]"

- case: upath_rglob
disable_cache: false
main: |
from upath import UPath

reveal_type(UPath("abc").rglob("efg")) # N: Revealed type is "typing.Generator[upath.core.UPath, None, None]"
reveal_type(UPath("abc").rglob("efg")) # N: Revealed type is "typing.Iterator[upath.core.UPath]"

- case: upath_is_dir
disable_cache: false
Expand Down Expand Up @@ -364,7 +364,7 @@
main: |
from upath import UPath

reveal_type(UPath("abc").iterdir()) # N: Revealed type is "typing.Generator[upath.core.UPath, None, None]"
reveal_type(UPath("abc").iterdir()) # N: Revealed type is "typing.Iterator[upath.core.UPath]"

- case: upath_lchmod
disable_cache: false
Expand Down Expand Up @@ -534,33 +534,15 @@

reveal_type(UPath("abc").write_text("efg")) # N: Revealed type is "builtins.int"

- case: upath_link_to_py39
- case: upath_link_to
disable_cache: false
mypy_config: python_version = 3.9
main: |
from upath import UPath

UPath("abc").link_to

- case: upath_link_to_py312plus
disable_cache: false
mypy_config: python_version = 3.12
main: |
from upath import UPath

UPath("abc").link_to # E: "UPath" has no attribute "link_to" [attr-defined]

- case: upath_walk_py39
disable_cache: false
mypy_config: python_version = 3.9
main: |
from upath import UPath

UPath("abc").walk # E: "UPath" has no attribute "walk" [attr-defined]

- case: upath_walk_py312plus
- case: upath_walk
disable_cache: false
mypy_config: python_version = 3.12
main: |
from upath import UPath

Expand Down
2 changes: 0 additions & 2 deletions upath/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Pathlib API extended to use fsspec backends."""

import sys

try:
from upath._version import __version__
except ImportError:
Expand Down
Loading