Universal Pathlib is a python library that aims to extend Python's built-in pathlib.Path
api to use a variety of backend filesystems using fsspec
pip install universal_pathlib
conda install -c conda-forge universal_pathlib
>>> from upath import UPath
>>> path = UPath("file:/some/filepath.py")
>>> path.name
filepath.py
>>> path.stem
filepath
>>> path.suffix
.py
>>> path.exists()
True
Some backends may require other dependencies. For example to work with S3 paths, s3fs
is required.
For more examples, see the example notebook here