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

Support Python 3.12 #152

Merged
merged 61 commits into from
Jan 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5c27ffc
(wip) initial work on py312 support
ap-- Oct 1, 2023
18fb5f6
(wip) an issue with parents
ap-- Oct 1, 2023
917ac80
tests: don't test private interface
ap-- Oct 1, 2023
df17a4d
core312plus: remove commented pathlib functionality
ap-- Oct 1, 2023
e56c5c1
cloud, local and memory versions
ap-- Oct 1, 2023
4b2bc8d
(wip) webdav, http
ap-- Oct 1, 2023
a7e77cc
upath.core version switch in init
ap-- Oct 1, 2023
f9c1356
tests: xfail some tests on python3.12
ap-- Oct 1, 2023
1f5337c
tests: fix minor issues with tests
ap-- Oct 1, 2023
c6d0298
tests: DummyFS should overwrite _strip_protocol too
ap-- Oct 1, 2023
dc9f81c
upath.core imports and minor fixes
ap-- Oct 1, 2023
125bee8
ci: enable 3.12 tests
ap-- Oct 1, 2023
1f8d878
test: fix private url attr test
ap-- Oct 1, 2023
6bfdc8a
upath: fix subclassing issue
ap-- Oct 3, 2023
85da9e4
local: inherit __init__ from UPath
ap-- Oct 3, 2023
3c992a5
upath.implementations.cloud: deprecate lists as args to joinpath
ap-- Oct 3, 2023
b1b7565
upath.implementations.cloud: use correct flavour/pathmod
ap-- Oct 3, 2023
f9b24cf
tests: xfail non-applicable __new__ test
ap-- Oct 3, 2023
c95c66c
upath.core312plus: fix typing issues
ap-- Oct 3, 2023
c1b5b4b
upath: 312 fix glob
ap-- Oct 3, 2023
cbefc37
upath: fix relative_to issues
ap-- Oct 3, 2023
d2a774b
tests: add missing nox session
ap-- Oct 4, 2023
0471a6c
WORKAROUND: missing aiohttp wheels on python3.12
ap-- Oct 4, 2023
e58e46d
WORKAROUND: missing pyarrow wheels on python3.12
ap-- Oct 4, 2023
8aa61c0
tests: adjust webdav test to include base_url in storage_options
ap-- Oct 5, 2023
8ef76d7
upath.implementations.local: remove debugging print
ap-- Oct 5, 2023
0f39bbf
upath: make storage_options readonly
ap-- Oct 5, 2023
218a9cb
upath: minor error message improvement
ap-- Oct 5, 2023
bc8b644
upath: fix pickling issue if subclasses change __init__ args
ap-- Oct 5, 2023
b4bf272
tests: relax kwargs test
ap-- Oct 5, 2023
bcdc9a2
upath.implementations.webdav: working webdav implementation
ap-- Oct 6, 2023
432cedb
upath.implementations.azure: fix touch
ap-- Oct 6, 2023
e9380c3
tests: update for empty parts paths
ap-- Oct 11, 2023
9549db3
upath: working http implementation
ap-- Oct 11, 2023
02b76ca
upath: working hdfs implementation
ap-- Oct 12, 2023
d83297c
upath: always add netloc to ensure fsspec compatibility
ap-- Oct 12, 2023
8ffee0a
upath: add memory path and rework netloc handling for memory
ap-- Oct 12, 2023
3cebeaa
upath: fix parts handling for http
ap-- Oct 12, 2023
e247c22
tests: update pathlib 3.12 tests
ap-- Oct 12, 2023
d3abe2b
upath: fix os.Pathlike support in get_upath_protocol
ap-- Oct 12, 2023
6f66999
fix mypy issues
ap-- Oct 12, 2023
df5db1b
upath.registry: clear implementation cache when overriding registration
ap-- Oct 14, 2023
6a992c2
upath.implementations.local: on 3.12 keep UPath.with_segments and sto…
ap-- Oct 14, 2023
f7eaf97
upath: make instance creation in UPath.__new__ more explicit
ap-- Oct 14, 2023
09ed883
upath: on 3.12 add some comments regarding missing functionality
ap-- Oct 14, 2023
77b6734
tests: minor adjustments to pathlib compatibility tests on 3.12
ap-- Oct 14, 2023
48b8e39
upath: py312 UPath.__new__ further clarify behavior
ap-- Oct 14, 2023
e36b678
tests: minor fixes in tests
ap-- Oct 14, 2023
8d5f9ba
upath: refactor local implementation
ap-- Oct 14, 2023
7900150
typing: ignore types for __new__ in PosixUPath/WindowsUPath
ap-- Oct 14, 2023
dd86cfa
upath.implementations.local: fix FilePath superclass
ap-- Oct 14, 2023
2878bff
tests: windows 3.12 walk recursion tests increase recursion_limit for…
ap-- Oct 14, 2023
636913f
Merge branch 'main' into support-py312
ap-- Jan 26, 2024
08d7ac3
fix linting
ap-- Jan 26, 2024
f6718b4
fix typing issue
ap-- Jan 26, 2024
777a398
upath.implementations.memory: normalize to two slashes for py312
ap-- Jan 26, 2024
2ac5f23
tests: adjust pathlib tests to accommodate fix from py-3.12.1
ap-- Jan 27, 2024
1d3589a
upath: switch to FSSpecFlavour implementation
ap-- Jan 29, 2024
415e9d2
nox: always set aiohttp workaround
ap-- Jan 29, 2024
a4d88cd
nox: disable mypy in lint session for now
ap-- Jan 30, 2024
8e09899
tests: update pytest and plugins
ap-- Jan 30, 2024
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
Prev Previous commit
Next Next commit
upath: py312 UPath.__new__ further clarify behavior
ap-- committed Oct 14, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 48b8e39121e2db378877cf46313c4331b3bc6d08
31 changes: 22 additions & 9 deletions upath/core312plus.py
Original file line number Diff line number Diff line change
@@ -164,17 +164,23 @@ def __new__(

# create a new instance
if cls is UPath:
# we called UPath() directly, and want an instance based on the
# provided or detected protocol (i.e. upath_cls)
obj: UPath = cast("UPath", object.__new__(upath_cls))
elif issubclass(cls, upath_cls):
obj: UPath = cast("UPath", object.__new__(cls))
elif issubclass(cls, UPath): #
obj: UPath = cast("UPath", object.__new__(upath_cls))
else:
raise RuntimeError("UPath.__new__ expected cls to be subclass of UPath")

obj._protocol = pth_protocol
obj._protocol = pth_protocol

if not isinstance(obj, cls) and not issubclass(upath_cls, cls):
elif issubclass(cls, upath_cls):
# we called a sub- or sub-sub-class of UPath, i.e. S3Path() and the
# corresponding upath_cls based on protocol is equal-to or a
# parent-of the cls.
obj = cast("UPath", object.__new__(cls)) # type: ignore[unreachable]
obj._protocol = pth_protocol

elif issubclass(cls, UPath):
# we called a subclass of UPath directly, i.e. S3Path() but the
# detected protocol would return a non-related UPath subclass, i.e.
# S3Path("file:///abc"). This behavior is going to raise an error
# in future versions
msg_protocol = repr(pth_protocol)
if not pth_protocol:
msg_protocol += " (empty string)"
@@ -190,10 +196,17 @@ def __new__(
f" {msg_protocol!s} replacing the default implementation."
)
warnings.warn(msg, DeprecationWarning, stacklevel=2)

obj = cast("UPath", object.__new__(upath_cls))
obj._protocol = pth_protocol

upath_cls.__init__(
obj, *args, protocol=pth_protocol, **storage_options
) # type: ignore

else:
raise RuntimeError("UPath.__new__ expected cls to be subclass of UPath")

return obj

def __init__(