Skip to content

Types 🏷

The types module provides type hints, protocols, and type aliases for working with UPath and filesystem operations. This includes abstract base classes, type aliases for path-like objects, and typed dictionaries for filesystem-specific storage options.

pathlib-abc base classes

These abstract base classes and protocols are re-exported from pathlib-abc They define the core path interfaces that stdlib pathlib and UPath implementations conform to.

JoinablePath

Bases: ABC

Abstract base class for pure path objects.

This class does not provide several magic methods that are defined in its implementation PurePath. They are: init, fspath, bytes, reduce, hash, eq, lt, le, gt, ge.

ReadablePath

Bases: JoinablePath

Abstract base class for readable path objects.

The Path class implements this ABC for local filesystem paths. Users may create subclasses to implement readable virtual filesystem paths, such as paths in archive files or on remote storage systems.

WritablePath

Bases: JoinablePath

Abstract base class for writable path objects.

The Path class implements this ABC for local filesystem paths. Users may create subclasses to implement writable virtual filesystem paths, such as paths in archive files or on remote storage systems.

PathInfo

Bases: Protocol

Protocol for path info objects, which support querying the file type. Methods may return cached results.

PathParser

Bases: Protocol

Protocol for path parsers, which do low-level path manipulation.

Path parsers provide a subset of the os.path API, specifically those functions needed to provide JoinablePath functionality. Each JoinablePath subclass references its path parser via a 'parser' class attribute.


UPath specific protocols

UPathParser

Bases: PathParser, Protocol

duck-type for upath.core.UPathParser


Type Aliases

Convenient type aliases for path-like objects used throughout UPath.

JoinablePathLike module-attribute

JoinablePathLike: TypeAlias = Union[
    JoinablePath, SupportsPathLike, str
]

Union of types that can be joined as path segments.

ReadablePathLike module-attribute

ReadablePathLike: TypeAlias = Union[
    ReadablePath, SupportsPathLike, str
]

Union of types that can be read from.

WritablePathLike module-attribute

WritablePathLike: TypeAlias = Union[
    WritablePath, SupportsPathLike, str
]

Union of types that can be written to.

SupportsPathLike module-attribute

SupportsPathLike: TypeAlias = Union[
    VFSPathLike, PathLike[str]
]

Union of objects that support __fspath__() or __vfspath__() protocols.

StatResultType

Bases: Protocol

duck-type for os.stat_result

Protocol for os.stat_result-like objects.


Storage Options

Typed dictionaries providing type hints for filesystem-specific configuration options. These help ensure correct parameter names and types when configuring different filesystems.

storage_options

Storage options types for various filesystems based on fsspec.

SimpleCacheStorageOptions

Storage options for SimpleCache

GCSStorageOptions

Storage options for Google Cloud Storage

S3StorageOptions

Storage options for AWS S3 and S3-compatible services

AzureStorageOptions

Storage options for Azure Blob Storage and Azure Data Lake Gen2

DataStorageOptions

Storage options for Data URIs filesystem

FTPStorageOptions

Storage options for FTP filesystem

GitHubStorageOptions

Storage options for GitHub repository filesystem

HDFSStorageOptions

Storage options for Hadoop Distributed File System (HDFS)

HTTPStorageOptions

Storage options for HTTP(S) filesystem

FileStorageOptions

Storage options for local filesystem (file:// and local:// protocols)

MemoryStorageOptions

Storage options for memory filesystem

SFTPStorageOptions

Storage options for SFTP/SSH filesystem

SMBStorageOptions

Storage options for SMB/Windows/Samba network shares

WebdavStorageOptions

Storage options for WebDAV filesystem

ZipStorageOptions

Storage options for ZIP archive filesystem

TarStorageOptions

Storage options for TAR archive filesystem (read-only)


See Also 🔗