You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zarr.open and friends should handle Path objects #601
Strictly, anything which doesn't cause os.fspath to raise a TypeError.
Minimal, reproducible code sample, a copy-pastable example if possible
importzarrfrompathlibimportPathpath_str="path/to/array.zarr"zarr.open(path_str) # works finezarr.open(Path(path_str)) # fails with TypeError because it's not a str and not iterable
Problem description
pathlib is great and everyone should use it whenever appropriate. Personally, I even subclass PurePosixPath for manipulations of object names inside hdf5/ zarr/ n5 containers.
People with zarr objects on the file system should want to use Paths to refer to them, so zarr should support people doing so.
This should just be a case of trying os.fspath on the store/path argument(s) for most of the functions in convenience.
Version and installation information
Please provide the following:
Value of zarr.__version__: 2.4.0
Value of numcodecs.__version__: 0.6.4
Version of Python interpreter: 3.8.5
Operating system (Linux/Windows/Mac): Linux
How Zarr was installed (e.g., "using pip into virtual environment", or "using conda"): pip in virtual environment
Reacted by Maximilian Roos, Davis Bennett, Brian Chen and Alessandro Amici
Ah, I see zarr still supports 3.5, which has pathlib but doesn't support it in much of the standard library, and doesn't have fspath. This can hold off a couple of days until 3.5 is EOL, then.
Activity
clbarnes commentedon Sep 11, 2020
Ah, I see zarr still supports 3.5, which has pathlib but doesn't support it in much of the standard library, and doesn't have fspath. This can hold off a couple of days until 3.5 is EOL, then.
clbarnes commentedon Sep 1, 2021
Released in 2.9.0: https://zarr.readthedocs.io/en/stable/release.html#enhancements