Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
fsspec[git,hdfs,dask,http,sftp,smb]==2025.3.2
fsspec[git,hdfs,dask,http,sftp,smb]==2025.7.0

# these dependencies define their own filesystems
adlfs==2024.12.0
boxfs==0.3.0
dropboxdrivefs==1.4.1
gcsfs==2025.3.2
s3fs==2025.3.2
gcsfs==2025.7.0
s3fs==2025.7.0
ocifs==1.3.2
webdav4[fsspec]==0.10.0
# gfrivefs @ git+https://github.com/fsspec/gdrivefs@master broken ...
morefs[asynclocalfs]==0.2.2
dvc==3.59.1
huggingface_hub==0.30.2
dvc==3.62.0
huggingface_hub==0.34.4
lakefs-spec==0.11.3
ossfs==2023.12.0
ossfs==2025.5.0
fsspec-xrootd==0.5.1
wandbfs==0.0.2
5 changes: 4 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,8 @@ def generate_flavours(session):
session.install("-r", "dev/requirements.txt")
with open("upath/_flavour_sources.py", "w") as target:
session.run(
"python", "dev/fsspec_inspector/generate_flavours.py", stdout=target
"python",
"dev/fsspec_inspector/generate_flavours.py",
stdout=target,
stderr=None,
)
115 changes: 85 additions & 30 deletions upath/_flavour_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
# - filecache
# - simplecache
# protocol import errors:
# - async_wrapper (None)
# - gdrive (Please install gdrivefs for access to Google Drive)
# - gdrive (Please install gdrive_fs for access to Google Drive)
# - generic (GenericFileSystem: '_strip_protocol' not a classmethod)
# - pyscript (Install requests (cpython) or run in pyscript)
# - tos (Install tosfs to access ByteDance volcano engine Tinder Object Storage)
# - tosfs (Install tosfs to access ByteDance volcano engine Tinder Object Storage)
#
from __future__ import annotations
Expand Down Expand Up @@ -89,7 +90,7 @@ def __init_subclass__(cls: Any, **kwargs):

class AbstractFileSystemFlavour(FileSystemFlavourBase):
__orig_class__ = 'fsspec.spec.AbstractFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol: str | tuple[str, ...] = 'abstract'
root_marker: Literal['', '/'] = ''
sep: Literal['/'] = '/'
Expand Down Expand Up @@ -136,6 +137,14 @@ def _parent(cls, path):
return cls.root_marker


class AsyncFileSystemWrapperFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.asyn_wrapper.AsyncFileSystemWrapper'
__orig_version__ = '2025.7.0'
protocol = ('asyncwrapper', 'async_wrapper')
root_marker = ''
sep = '/'


class AsyncLocalFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'morefs.asyn_local.AsyncLocalFileSystem'
__orig_version__ = '0.2.2'
Expand Down Expand Up @@ -314,7 +323,7 @@ def _strip_protocol(cls, path) -> str:

class DaskWorkerFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.dask.DaskWorkerFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('dask',)
root_marker = ''
sep = '/'
Expand All @@ -330,15 +339,15 @@ def _get_kwargs_from_urls(path):

class DataFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.data.DataFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('data',)
root_marker = ''
sep = '/'


class DatabricksFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.dbfs.DatabricksFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('dbfs',)
root_marker = ''
sep = '/'
Expand Down Expand Up @@ -371,7 +380,7 @@ class DropboxDriveFileSystemFlavour(AbstractFileSystemFlavour):

class FTPFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.ftp.FTPFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('ftp',)
root_marker = '/'
sep = '/'
Expand All @@ -390,7 +399,7 @@ def _get_kwargs_from_urls(urlpath):

class GCSFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'gcsfs.core.GCSFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('gs', 'gcs')
root_marker = ''
sep = '/'
Expand Down Expand Up @@ -465,9 +474,57 @@ def _split_path(cls, path, version_aware=False):
)


class GistFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.gist.GistFileSystem'
__orig_version__ = '2025.7.0'
protocol = ('gist',)
root_marker = ''
sep = '/'

@classmethod
def _strip_protocol(cls, path):
"""
Remove 'gist://' from the path, if present.
"""
# The default infer_storage_options can handle gist://username:token@id/file
# or gist://id/file, but let's ensure we handle a normal usage too.
# We'll just strip the protocol prefix if it exists.
path = infer_storage_options(path).get("path", path)
return path.lstrip("/")

@staticmethod
def _get_kwargs_from_urls(path):
"""
Parse 'gist://' style URLs into GistFileSystem constructor kwargs.
For example:
gist://:TOKEN@<gist_id>/file.txt
gist://username:TOKEN@<gist_id>/file.txt
"""
so = infer_storage_options(path)
out = {}
if "username" in so and so["username"]:
out["username"] = so["username"]
if "password" in so and so["password"]:
out["token"] = so["password"]
if "host" in so and so["host"]:
# We interpret 'host' as the gist ID
out["gist_id"] = so["host"]

# Extract SHA and filename from path
if "path" in so and so["path"]:
path_parts = so["path"].rsplit("/", 2)[-2:]
if len(path_parts) == 2:
if path_parts[0]: # SHA present
out["sha"] = path_parts[0]
if path_parts[1]: # filename also present
out["filenames"] = [path_parts[1]]

return out


class GitFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.git.GitFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('git',)
root_marker = ''
sep = '/'
Expand All @@ -483,8 +540,7 @@ def _strip_protocol(cls, path):

@staticmethod
def _get_kwargs_from_urls(path):
if path.startswith("git://"):
path = path[6:]
path = path.removeprefix("git://")
out = {}
if ":" in path:
out["path"], path = path.split(":", 1)
Expand All @@ -495,7 +551,7 @@ def _get_kwargs_from_urls(path):

class GithubFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.github.GithubFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('github',)
root_marker = ''
sep = '/'
Expand All @@ -520,7 +576,7 @@ def _get_kwargs_from_urls(path):

class HTTPFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.http.HTTPFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('http', 'https')
root_marker = ''
sep = '/'
Expand All @@ -541,7 +597,7 @@ def _parent(cls, path):

class HadoopFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.arrow.HadoopFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('hdfs', 'arrow_hdfs')
root_marker = '/'
sep = '/'
Expand Down Expand Up @@ -574,15 +630,15 @@ def _get_kwargs_from_urls(path):

class HfFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'huggingface_hub.hf_file_system.HfFileSystem'
__orig_version__ = '0.30.2'
__orig_version__ = '0.34.4'
protocol = ('hf',)
root_marker = ''
sep = '/'


class JupyterFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.jupyter.JupyterFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('jupyter', 'jlab')
root_marker = ''
sep = '/'
Expand All @@ -608,7 +664,7 @@ def _strip_protocol(cls, path):

class LibArchiveFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.libarchive.LibArchiveFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('libarchive',)
root_marker = ''
sep = '/'
Expand All @@ -621,7 +677,7 @@ def _strip_protocol(cls, path):

class LocalFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.local.LocalFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('file', 'local')
root_marker = '/'
sep = '/'
Expand Down Expand Up @@ -699,7 +755,7 @@ def _strip_protocol(cls, path):

class MemoryFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.memory.MemoryFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('memory',)
root_marker = '/'
sep = '/'
Expand All @@ -712,8 +768,7 @@ def _strip_protocol(cls, path):
else:
path = stringify_path(path)

if path.startswith("memory://"):
path = path[len("memory://") :]
path = path.removeprefix("memory://")
if "::" in path or "://" in path:
return path.rstrip("/")
path = path.lstrip("/").rstrip("/")
Expand Down Expand Up @@ -750,7 +805,7 @@ def _parent(cls, path):

class OSSFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'ossfs.core.OSSFileSystem'
__orig_version__ = '2023.12.0'
__orig_version__ = '2025.5.0'
protocol = ('oss',)
root_marker = ''
sep = '/'
Expand Down Expand Up @@ -798,15 +853,15 @@ class OverlayFileSystemFlavour(AbstractFileSystemFlavour):

class ReferenceFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.reference.ReferenceFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('reference',)
root_marker = ''
sep = '/'


class S3FileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 's3fs.core.S3FileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('s3', 's3a')
root_marker = ''
sep = '/'
Expand Down Expand Up @@ -834,7 +889,7 @@ def _get_kwargs_from_urls(urlpath):

class SFTPFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.sftp.SFTPFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('sftp', 'ssh')
root_marker = ''
sep = '/'
Expand All @@ -853,7 +908,7 @@ def _get_kwargs_from_urls(urlpath):

class SMBFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.smb.SMBFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('smb',)
root_marker = ''
sep = '/'
Expand All @@ -873,7 +928,7 @@ def _get_kwargs_from_urls(path):

class TarFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.tar.TarFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('tar',)
root_marker = ''
sep = '/'
Expand All @@ -889,7 +944,7 @@ class WandbFSFlavour(AbstractFileSystemFlavour):

class WebHDFSFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.webhdfs.WebHDFS'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('webhdfs', 'webHDFS')
root_marker = ''
sep = '/'
Expand Down Expand Up @@ -950,7 +1005,7 @@ def _get_kwargs_from_urls(u: str) -> dict[Any, Any]:

class ZipFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'fsspec.implementations.zip.ZipFileSystem'
__orig_version__ = '2025.3.2'
__orig_version__ = '2025.7.0'
protocol = ('zip',)
root_marker = ''
sep = '/'
Expand All @@ -963,7 +1018,7 @@ def _strip_protocol(cls, path):

class _DVCFileSystemFlavour(AbstractFileSystemFlavour):
__orig_class__ = 'dvc.fs.dvc._DVCFileSystem'
__orig_version__ = '3.59.1'
__orig_version__ = '3.62.0'
protocol = ('dvc',)
root_marker = '/'
sep = '/'
Loading