xqute.path
Provides the SpecPath and MountedPath classes.
It is used to represent paths of jobs and it is useful when a job is running in a remote system (a VM, a container, etc.), where we need to mount the paths into the remote system (MountedPath).
But in the system where this framework is running, we need to use the paths (specified directly) that are used in the framework, where we also need to carry the information of the mounted path (SpecPath).
The module provides two main abstract base classes:
- -
MountedPath: Represents a path as it appears in the remote execution environment. - -
SpecPath: Represents a path as it appears in the local environment where the
Both classes have implementations for local paths and various cloud storage paths, including:
- - Google Cloud Storage
- - Azure Blob Storage
- - Amazon S3
These classes maintain the relationship between the local and remote pathrepresentations, allowing transparent path operations while preserving both path contexts.
MountedPath(MountedPath) — A router class to instantiate the correct path based on the path typefor the mounted path. </>MountedLocalPath(MountedPath) — A class to represent a mounted local path</>MountedCloudPath(path,spec,*args,**kwargs)(MountedPath) — A class to represent a mounted cloud path</>MountedGSPath(MountedPath) — A class to represent a mounted Google Cloud Storage path</>MountedAzurePath(MountedPath) — A class to represent a mounted Azure Blob Storage path</>MountedS3Path(MountedPath) — A class to represent a mounted Amazon S3 path</>SpecPath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A router class to instantiate the correct path based on the path typefor the spec path. </>SpecLocalPath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec local path</>SpecCloudPath(path,*args,mounted,**kwargs)(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec cloud path</>SpecGSPath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec Google Cloud Storage path</>SpecAzurePath(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec Azure Blob Storage path</>SpecS3Path(xqute.path.speclocalpath | xqute.path.speccloudpath) — A class to represent a spec Amazon S3 path</>
xqute.path.MountedPath(path, spec=None, *args, **kwargs) → MountedPath
A router class to instantiate the correct path based on the path typefor the mounted path.
This abstract base class serves as a factory that creates appropriate mounted path instances based on the input path type. It represents a path as it exists in a remote execution environment (e.g., container, VM) while maintaining a reference to the corresponding path in the local environment.
_spec— The corresponding path in the local environment (SpecPath).anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> # Create a mounted path with corresponding spec path>>> mounted_path = MountedPath(
>>> "/container/data/file.txt", spec="/local/data/file.txt"
>>> )
>>> str(mounted_path)
'/container/data/file.txt'
>>> str(mounted_path.spec)
'/local/data/file.txt'
>>> # Create a GCS mounted path
>>> gs_path = MountedPath("gs://bucket/file.txt", spec="/local/file.txt")
>>> type(gs_path)
<class 'xqute.path.MountedGSPath'>
>>> # Serialize and deserialize a mounted path
>>> import pickle
>>> mounted_path = MountedPath("/container/data/file.txt",
... spec="/local/data/file.txt")
>>> serialized = pickle.dumps(mounted_path)
>>> restored = pickle.loads(serialized)
>>> str(restored) == str(mounted_path)
True
>>> str(restored.spec) == str(mounted_path.spec)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target)(PanPath) — Asynchronously copy this path to the target path.</>a_copytree(target,follow_symlinks)(PanPath) — Asynchronously copy the directory and all its contents recursively to the target path.</>a_exists()(bool) — Asynchronously check if the path exists.</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a glob pattern.</>a_is_dir()(bool) — Asynchronously check if the path is a directory.</>a_is_file()(bool) — Asynchronously check if the path is a file.</>a_is_symlink()(bool) — Asynchronously check if the path is a symbolic link.</>a_iterdir()(AsyncGenerator) — Asynchronously iterate over directory contents.</>a_mkdir(mode,parents,exist_ok)— Asynchronously create a directory at this path.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Asynchronously open the file and return an async file handle.</>a_read_bytes()(bytes) — Asynchronously read the file's bytes.</>a_read_text(encoding)(str) — Asynchronously read the file's text content.</>a_readlink()(PanPath) — Asynchronously read the target of the symbolic link.</>a_rename(target)(PanPath) — Asynchronously rename this path to the target path.</>a_replace(target)(PanPath) — Asynchronously replace this path with the target path.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a recursive glob pattern.</>a_rmdir()— Asynchronously remove the directory and its contents recursively.</>a_rmtree(ignore_errors,onerror)— Asynchronously remove the directory and all its contents recursively.</>a_stat(follow_symlinks)(stat_result) — Asynchronously get the file or directory's status information.</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to the target path.</>a_touch(mode,exist_ok)— Asynchronously create the file if it does not exist.</>a_unlink(missing_ok)— Asynchronously remove (delete) the file or empty directory.</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(Optional) — Asynchronously write bytes to the file.</>a_write_text(data,encoding)(int) — Asynchronously write text to the file.</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed to by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)— Rename this path to the target path.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove this directory. The directory must be empty.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk()— Walk the directory tree.</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
__str__()
Return the string representation of the path, suitable forpassing to system calls.
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
as_uri()
Return the path as a 'file' URI.
with_stem(stem)
Return a new path with the stem changed.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
match(path_pattern, case_sensitive=None)
Return True if this path matches the given pattern.
stat(follow_symlinks=True)
Return the result of the stat() system call on this path, likeos.stat() does.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
exists(follow_symlinks=True)
Whether this path exists.
This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.
is_dir()
Whether this path is a directory.
is_file()
Whether this path is a regular file (also True for symlinks pointingto regular files).
is_mount()
Check if this path is a mount point
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
samefile(other_path)
Return whether other_path is the same or not as this file(as returned by os.path.samefile()).
open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open the file pointed to by this path and return a file object, asthe built-in open() function does.
read_bytes()
Open the file in bytes mode, read it, and close the file.
read_text(encoding=None, errors=None)
Open the file in text mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
iterdir()
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.
glob(pattern, case_sensitive=None)
Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.
rglob(pattern, case_sensitive=None)
Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
absolute()
Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.
Use resolve() to get the canonical path to a file.
resolve(strict=False)
Make the path absolute, resolving all symlinks on the way and alsonormalizing it.
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
readlink()
Return the path to which the symbolic link points.
touch(mode=438, exist_ok=True)
Create this file with the given access mode, if it doesn't exist.
mkdir(mode=511, parents=False, exist_ok=False)
Create a new directory at this given path.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
unlink(missing_ok=False)
Remove this file or link.If the path is a directory, use rmdir() instead.
rmdir()
Remove this directory. The directory must be empty.
rename(target)
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
replace(target)
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_exists()
Asynchronously check if the path exists.
True if the path exists, False otherwise.
a_read_bytes()
Asynchronously read the file's bytes.
File content as bytes.
a_read_text(encoding='utf-8')
Asynchronously read the file's text content.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
File content as string.
a_write_bytes(data)
Asynchronously write bytes to the file.
data(bytes) — Bytes to write to the file.
Number of bytes written. For some cloud paths, may return None.
a_write_text(data, encoding='utf-8')
Asynchronously write text to the file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Number of characters written.
a_unlink(missing_ok=False)
Asynchronously remove (delete) the file or empty directory.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir()
Asynchronously iterate over directory contents.
PanPath instances for each item in the directory.
a_is_dir()
Asynchronously check if the path is a directory.
True if the path is a directory, False otherwise.
a_is_file()
Asynchronously check if the path is a file.
True if the path is a file, False otherwise.
a_stat(follow_symlinks=True)
Asynchronously get the file or directory's status information.
An object containing file status information (platform-dependent).
a_mkdir(mode=511, parents=False, exist_ok=False)
Asynchronously create a directory at this path.
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
a_glob(pattern)
Asynchronously yield paths matching a glob pattern.
pattern(str) — Glob pattern to match.
List of PanPath instances matching the pattern.
a_rglob(pattern)
Asynchronously yield paths matching a recursive glob pattern.
pattern(str) — Recursive glob pattern to match.
List of PanPath instances matching the pattern.
a_walk()
Asynchronously walk the directory tree.
Tuples of (current_path, dirnames, filenames) at each level.
a_touch(mode=438, exist_ok=True)
Asynchronously create the file if it does not exist.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raises an error if the file already exists.
a_rename(target)
Asynchronously rename this path to the target path.
target(Union) — New path to rename to.
The renamed PanPath instance.
a_replace(target)
Asynchronously replace this path with the target path.
target(Union) — New path to replace with.
The replaced PanPath instance.
a_rmdir()
Asynchronously remove the directory and its contents recursively.
a_is_symlink()
Asynchronously check if the path is a symbolic link.
For local path, this checks if the path is a symlink. For cloud paths, this will check if the object has a metdata flag indicating it's a symlink. Note that it is not a real symlink like in local filesystems. But for example, gcsfuse supports symlink-like behavior via metadata.
True if the path is a symlink, False otherwise.
a_readlink()
Asynchronously read the target of the symbolic link.
For local path, this reads the symlink target. For cloud paths, this reads the metadata flag indicating the symlink target.
The target PanPath of the symlink.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to the target path.
For local path, this creates a real symlink. For cloud paths, this sets a metadata flag indicating the symlink target.
target(Union) — The target PanPath the symlink points to.target_is_directory(bool, optional) — Whether the target is a directory (ignored for cloud paths).
a_rmtree(ignore_errors=False, onerror=None)
Asynchronously remove the directory and all its contents recursively.
ignore_errors(bool, optional) — If True, ignores errors during removal.onerror(Any, optional) — Optional function to call on errors.
a_copy(target)
Asynchronously copy this path to the target path.
target(Union) — Destination PanPath to copy to.
The copied PanPath instance.
a_copytree(target, follow_symlinks=True)
Asynchronously copy the directory and all its contents recursively to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
a_open(mode='r', encoding='utf-8', **kwargs)
Asynchronously open the file and return an async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(str, optional) — Text encoding to use (default: 'utf-8').**kwargs(Any) — Additional arguments to pass to the underlying open method.
An async file handle.
walk()
Walk the directory tree.
Tuples of (current_path, dirnames, filenames) at each level.
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
xqute.path.MountedLocalPath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted local path
This class represents a path in a local filesystem as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> mounted_path = MountedLocalPath("/container/data/file.txt",... spec="/local/data/file.txt")
>>> str(mounted_path)
'/container/data/file.txt'
>>> str(mounted_path.spec)
'/local/data/file.txt'
>>> mounted_path.name
'file.txt'
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>a_exists()(bool) — Check if path exists (async).</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching the glob pattern.</>a_is_dir()(bool) — Check if path is a directory (async).</>a_is_file()(bool) — Check if path is a file (async).</>a_is_symlink()(bool) — Check if path is a symlink (async).</>a_iterdir()(AsyncGenerator) — List directory contents (async).</>a_mkdir(mode,parents,exist_ok)— Create directory (async).</>a_open(mode,buffering,encoding,errors,newline)(Any) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes (async).</>a_read_text(encoding)(str) — Read file as text (async).</>a_readlink()(LocalPath) — Asynchronously read the target of a symbolic link.</>a_rename(target)(PanPath) — Rename the file or directory to target.</>a_replace(target)(PanPath) — Rename the file or directory to target, overwriting if target exists.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively yield all existing files matching the given pattern.</>a_rmdir()— Remove empty directory (async).</>a_rmtree()— Recursively remove directory and its contents (async).</>a_stat(follow_symlinks)(stat_result) — Get file stats (async).</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to target.</>a_touch(mode,exist_ok)— Create the file if it does not exist or update the modification time (async).</>a_unlink(missing_ok)— Delete file (async).</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(int) — Write bytes to file (async).</>a_write_text(data,encoding)(int) — Write text to file (async).</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(PanPath) — Copy file to target.</>copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed to by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(PanPath) — Rename the file or directory to target.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove empty directory.</>rmtree()— Recursively remove directory and its contents.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk(*args,**kwargs)(Iterator) — Walk the directory tree.</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
__str__()
Return the string representation of the path, suitable forpassing to system calls.
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
as_uri()
Return the path as a 'file' URI.
with_stem(stem)
Return a new path with the stem changed.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
match(path_pattern, case_sensitive=None)
Return True if this path matches the given pattern.
stat(follow_symlinks=True)
Return the result of the stat() system call on this path, likeos.stat() does.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
exists(follow_symlinks=True)
Whether this path exists.
This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.
is_dir()
Whether this path is a directory.
is_file()
Whether this path is a regular file (also True for symlinks pointingto regular files).
is_mount()
Check if this path is a mount point
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
samefile(other_path)
Return whether other_path is the same or not as this file(as returned by os.path.samefile()).
open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open the file pointed to by this path and return a file object, asthe built-in open() function does.
read_bytes()
Open the file in bytes mode, read it, and close the file.
read_text(encoding=None, errors=None)
Open the file in text mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
iterdir()
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.
glob(pattern, case_sensitive=None)
Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.
rglob(pattern, case_sensitive=None)
Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
absolute()
Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.
Use resolve() to get the canonical path to a file.
resolve(strict=False)
Make the path absolute, resolving all symlinks on the way and alsonormalizing it.
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
readlink()
Return the path to which the symbolic link points.
touch(mode=438, exist_ok=True)
Create this file with the given access mode, if it doesn't exist.
mkdir(mode=511, parents=False, exist_ok=False)
Create a new directory at this given path.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
unlink(missing_ok=False)
Remove this file or link.If the path is a directory, use rmdir() instead.
replace(target)
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_touch(mode=438, exist_ok=True)
Create the file if it does not exist or update the modification time (async).
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raises an error if the file already exists.
a_rename(target)
Rename the file or directory to target.
target(Union) — New path
New path instance
a_replace(target)
Rename the file or directory to target, overwriting if target exists.
target(Union) — New path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
a_walk()
Asynchronously walk the directory tree.
A list of tuples (dirpath, dirnames, filenames)
a_readlink()
Asynchronously read the target of a symbolic link.
The path to which the symbolic link points.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to target.
target(Union) — The target path the symbolic link points to.target_is_directory(bool, optional) — Whether the target is a directory.
a_glob(pattern)
Asynchronously yield paths matching the glob pattern.
pattern(str) — Glob pattern (relative)
Matching LocalPath instances
a_rglob(pattern)
Recursively yield all existing files matching the given pattern.
pattern(str) — Glob pattern (relative)
Matching LocalPath instances
a_exists() → bool
Check if path exists (async).
a_is_file() → bool
Check if path is a file (async).
a_is_dir() → bool
Check if path is a directory (async).
a_read_bytes() → bytes
Read file as bytes (async).
a_read_text(encoding='utf-8') → str
Read file as text (async).
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data) → int
Write bytes to file (async).
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file (async).
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_is_symlink() → bool
Check if path is a symlink (async).
a_unlink(missing_ok=False)
Delete file (async).
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create directory (async).
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
a_rmdir()
Remove empty directory (async).
a_rmtree()
Recursively remove directory and its contents (async).
a_iterdir() → AsyncGenerator
List directory contents (async).
a_stat(follow_symlinks=True) → stat_result
Get file stats (async).
a_open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open file and return async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(Optional, optional) — Text encoding to use (default: 'utf-8').
Async file handle from aiofiles
rename(target)
Rename the file or directory to target.
target(Union) — New path
New path instance
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If True, follow symbolic links
Target path instance
copytree(target, follow_symlinks=True)
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
rmdir()
Remove empty directory.
rmtree()
Recursively remove directory and its contents.
walk(*args, **kwargs)
Walk the directory tree.
A list of tuples (dirpath, dirnames, filenames)
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
xqute.path.MountedCloudPath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted cloud path
This class represents a cloud storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> mounted_path = MountedPath("gs://bucket/file.txt",... spec="gs://local-bucket/file.txt")
>>> str(mounted_path)
'gs://bucket/file.txt'
>>> str(mounted_path.spec)
'gs://local-bucket/file.txt'
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
with_stem(stem)
Return a new path with the stem changed.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
a_write_bytes(data)
Write bytes to file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
a_unlink(missing_ok=False)
Delete file.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.MountedGSPath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted Google Cloud Storage path
This class represents a Google Cloud Storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> mounted_path = MountedPath("gs://bucket/file.txt",... spec="gs://local-bucket/file.txt")
>>> isinstance(mounted_path, MountedGSPath)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
with_stem(stem)
Return a new path with the stem changed.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_unlink(missing_ok=False)
Delete file.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.MountedAzurePath(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted Azure Blob Storage path
This class represents an Azure Blob Storage path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> mounted_path = MountedPath("az://container/blob",... spec="az://local-container/blob")
>>> isinstance(mounted_path, MountedAzurePath)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
with_stem(stem)
Return a new path with the stem changed.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_unlink(missing_ok=False)
Delete file.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.MountedS3Path(path, spec=None, *args, **kwargs) → MountedPath
A class to represent a mounted Amazon S3 path
This class represents an Amazon S3 path as it appears in a remote execution environment, while maintaining a reference to its corresponding path in the framework's environment.
_spec— The corresponding path in the local environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>spec— Get the corresponding spec path in the local environment.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> mounted_path = MountedPath("s3://bucket/key",... spec="s3://local-bucket/key")
>>> isinstance(mounted_path, MountedS3Path)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the MountedPath.</>__new__(cls,path,spec,*args,**kwargs)(An instance of the appropriate MountedPath subclass based on the path type) — Factory method to create the appropriate MountedPath subclass instance.</>__reduce__()— Support for pickling and serialization.</>__repr__()(str) — Generate a string representation of the MountedPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__setstate__(state)— Restore internal state after unpickling.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(MountedPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_mounted()(bool) — Check if this path is actually mounted (different from spec path).</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(MountedPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(MountedPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)— Return a new path with the stem changed.</>with_suffix(suffix)(MountedPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
with_stem(stem)
Return a new path with the stem changed.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_unlink(missing_ok=False)
Delete file.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, spec=None, *args, **kwargs)
Factory method to create the appropriate MountedPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the mounted path location.spec(str | pathlib.path | none, optional) — The path string or object representing the corresponding spec path.If None, the mounted path itself will be used as the spec path.
ss s s
is_mounted()
Check if this path is actually mounted (different from spec path).
True if the mounted path is different from the spec path, Falseotherwise.
__repr__()
Generate a string representation of the MountedPath.
A string showing the class name, path, and spec path (if different).
__eq__(other)
Check equality with another path object.
Two MountedPath objects are equal if they have the same path string and the same spec path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the MountedPath.
A hash value based on the path string and spec path string.
__reduce__()
Support for pickling and serialization.
Returns a tuple of (callable, args, state) so that the underlying path is reconstructed from its string, and the spec relationship is restored via state.
__setstate__(state)
Restore internal state after unpickling.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new mounted path with the name changed in both the mounted path and spec path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new mounted path with the suffix changed in both the mounted path and spec path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new mounted path with the segments appended to both the mounted path and spec path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new mounted path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A router class to instantiate the correct path based on the path typefor the spec path.
This abstract base class serves as a factory that creates appropriate spec path instances based on the input path type. It represents a path in the local environment where the framework runs, while maintaining a reference to the corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> # Create a spec path with corresponding mounted path>>> spec_path = SpecPath(
>>> "/local/data/file.txt", mounted="/container/data/file.txt"
>>> )
>>> str(spec_path)
'/local/data/file.txt'
>>> str(spec_path.mounted)
'/container/data/file.txt'
>>> # Create a GCS spec path
>>> gs_path = SpecPath(
>>> "gs://bucket/file.txt", mounted="gs://container-bucket/file.txt"
>>> )
>>> type(gs_path)
<class 'xqute.path.SpecGSPath'>
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target)(PanPath) — Asynchronously copy this path to the target path.</>a_copytree(target,follow_symlinks)(PanPath) — Asynchronously copy the directory and all its contents recursively to the target path.</>a_exists()(bool) — Asynchronously check if the path exists.</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a glob pattern.</>a_is_dir()(bool) — Asynchronously check if the path is a directory.</>a_is_file()(bool) — Asynchronously check if the path is a file.</>a_is_symlink()(bool) — Asynchronously check if the path is a symbolic link.</>a_iterdir()(AsyncGenerator) — Asynchronously iterate over directory contents.</>a_mkdir(mode,parents,exist_ok)— Asynchronously create a directory at this path.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Asynchronously open the file and return an async file handle.</>a_read_bytes()(bytes) — Asynchronously read the file's bytes.</>a_read_text(encoding)(str) — Asynchronously read the file's text content.</>a_readlink()(PanPath) — Asynchronously read the target of the symbolic link.</>a_rename(target)(PanPath) — Asynchronously rename this path to the target path.</>a_replace(target)(PanPath) — Asynchronously replace this path with the target path.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Asynchronously yield paths matching a recursive glob pattern.</>a_rmdir()— Asynchronously remove the directory and its contents recursively.</>a_rmtree(ignore_errors,onerror)— Asynchronously remove the directory and all its contents recursively.</>a_stat(follow_symlinks)(stat_result) — Asynchronously get the file or directory's status information.</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to the target path.</>a_touch(mode,exist_ok)— Asynchronously create the file if it does not exist.</>a_unlink(missing_ok)— Asynchronously remove (delete) the file or empty directory.</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(Optional) — Asynchronously write bytes to the file.</>a_write_text(data,encoding)(int) — Asynchronously write text to the file.</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed to by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)— Rename this path to the target path.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove this directory. The directory must be empty.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk()— Walk the directory tree.</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
__str__()
Return the string representation of the path, suitable forpassing to system calls.
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
as_uri()
Return the path as a 'file' URI.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
match(path_pattern, case_sensitive=None)
Return True if this path matches the given pattern.
stat(follow_symlinks=True)
Return the result of the stat() system call on this path, likeos.stat() does.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
exists(follow_symlinks=True)
Whether this path exists.
This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.
is_dir()
Whether this path is a directory.
is_file()
Whether this path is a regular file (also True for symlinks pointingto regular files).
is_mount()
Check if this path is a mount point
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
samefile(other_path)
Return whether other_path is the same or not as this file(as returned by os.path.samefile()).
open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open the file pointed to by this path and return a file object, asthe built-in open() function does.
read_bytes()
Open the file in bytes mode, read it, and close the file.
read_text(encoding=None, errors=None)
Open the file in text mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
iterdir()
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.
glob(pattern, case_sensitive=None)
Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.
rglob(pattern, case_sensitive=None)
Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
absolute()
Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.
Use resolve() to get the canonical path to a file.
resolve(strict=False)
Make the path absolute, resolving all symlinks on the way and alsonormalizing it.
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
readlink()
Return the path to which the symbolic link points.
touch(mode=438, exist_ok=True)
Create this file with the given access mode, if it doesn't exist.
mkdir(mode=511, parents=False, exist_ok=False)
Create a new directory at this given path.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
unlink(missing_ok=False)
Remove this file or link.If the path is a directory, use rmdir() instead.
rmdir()
Remove this directory. The directory must be empty.
rename(target)
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
replace(target)
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_exists()
Asynchronously check if the path exists.
True if the path exists, False otherwise.
a_read_bytes()
Asynchronously read the file's bytes.
File content as bytes.
a_read_text(encoding='utf-8')
Asynchronously read the file's text content.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
File content as string.
a_write_bytes(data)
Asynchronously write bytes to the file.
data(bytes) — Bytes to write to the file.
Number of bytes written. For some cloud paths, may return None.
a_write_text(data, encoding='utf-8')
Asynchronously write text to the file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
Number of characters written.
a_unlink(missing_ok=False)
Asynchronously remove (delete) the file or empty directory.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir()
Asynchronously iterate over directory contents.
PanPath instances for each item in the directory.
a_is_dir()
Asynchronously check if the path is a directory.
True if the path is a directory, False otherwise.
a_is_file()
Asynchronously check if the path is a file.
True if the path is a file, False otherwise.
a_stat(follow_symlinks=True)
Asynchronously get the file or directory's status information.
An object containing file status information (platform-dependent).
a_mkdir(mode=511, parents=False, exist_ok=False)
Asynchronously create a directory at this path.
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
a_glob(pattern)
Asynchronously yield paths matching a glob pattern.
pattern(str) — Glob pattern to match.
List of PanPath instances matching the pattern.
a_rglob(pattern)
Asynchronously yield paths matching a recursive glob pattern.
pattern(str) — Recursive glob pattern to match.
List of PanPath instances matching the pattern.
a_walk()
Asynchronously walk the directory tree.
Tuples of (current_path, dirnames, filenames) at each level.
a_touch(mode=438, exist_ok=True)
Asynchronously create the file if it does not exist.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raises an error if the file already exists.
a_rename(target)
Asynchronously rename this path to the target path.
target(Union) — New path to rename to.
The renamed PanPath instance.
a_replace(target)
Asynchronously replace this path with the target path.
target(Union) — New path to replace with.
The replaced PanPath instance.
a_rmdir()
Asynchronously remove the directory and its contents recursively.
a_is_symlink()
Asynchronously check if the path is a symbolic link.
For local path, this checks if the path is a symlink. For cloud paths, this will check if the object has a metdata flag indicating it's a symlink. Note that it is not a real symlink like in local filesystems. But for example, gcsfuse supports symlink-like behavior via metadata.
True if the path is a symlink, False otherwise.
a_readlink()
Asynchronously read the target of the symbolic link.
For local path, this reads the symlink target. For cloud paths, this reads the metadata flag indicating the symlink target.
The target PanPath of the symlink.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to the target path.
For local path, this creates a real symlink. For cloud paths, this sets a metadata flag indicating the symlink target.
target(Union) — The target PanPath the symlink points to.target_is_directory(bool, optional) — Whether the target is a directory (ignored for cloud paths).
a_rmtree(ignore_errors=False, onerror=None)
Asynchronously remove the directory and all its contents recursively.
ignore_errors(bool, optional) — If True, ignores errors during removal.onerror(Any, optional) — Optional function to call on errors.
a_copy(target)
Asynchronously copy this path to the target path.
target(Union) — Destination PanPath to copy to.
The copied PanPath instance.
a_copytree(target, follow_symlinks=True)
Asynchronously copy the directory and all its contents recursively to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
a_open(mode='r', encoding='utf-8', **kwargs)
Asynchronously open the file and return an async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(str, optional) — Text encoding to use (default: 'utf-8').**kwargs(Any) — Additional arguments to pass to the underlying open method.
An async file handle.
walk()
Walk the directory tree.
Tuples of (current_path, dirnames, filenames) at each level.
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
xqute.path.SpecLocalPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec local path
This class represents a path in the local filesystem as it appears in the framework's environment, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>drive— The drive prefix (letter or UNC path), if any.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> spec_path = SpecLocalPath("/local/data/file.txt",... mounted="/container/data/file.txt")
>>> str(spec_path)
'/local/data/file.txt'
>>> str(spec_path.mounted)
'/container/data/file.txt'
>>> spec_path.name
'file.txt'
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__str__()— Return the string representation of the path, suitable forpassing to system calls. </>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>a_exists()(bool) — Check if path exists (async).</>a_glob(pattern)(AsyncGenerator) — Asynchronously yield paths matching the glob pattern.</>a_is_dir()(bool) — Check if path is a directory (async).</>a_is_file()(bool) — Check if path is a file (async).</>a_is_symlink()(bool) — Check if path is a symlink (async).</>a_iterdir()(AsyncGenerator) — List directory contents (async).</>a_mkdir(mode,parents,exist_ok)— Create directory (async).</>a_open(mode,buffering,encoding,errors,newline)(Any) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes (async).</>a_read_text(encoding)(str) — Read file as text (async).</>a_readlink()(LocalPath) — Asynchronously read the target of a symbolic link.</>a_rename(target)(PanPath) — Rename the file or directory to target.</>a_replace(target)(PanPath) — Rename the file or directory to target, overwriting if target exists.</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively yield all existing files matching the given pattern.</>a_rmdir()— Remove empty directory (async).</>a_rmtree()— Recursively remove directory and its contents (async).</>a_stat(follow_symlinks)(stat_result) — Get file stats (async).</>a_symlink_to(target,target_is_directory)— Asynchronously create a symbolic link pointing to target.</>a_touch(mode,exist_ok)— Create the file if it does not exist or update the modification time (async).</>a_unlink(missing_ok)— Delete file (async).</>a_walk()(AsyncGenerator) — Asynchronously walk the directory tree.</>a_write_bytes(data)(int) — Write bytes to file (async).</>a_write_text(data,encoding)(int) — Write text to file (async).</>absolute()— Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed. </>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()— Return the path as a 'file' URI.</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(PanPath) — Copy file to target.</>copytree(target,follow_symlinks)(PanPath) — Recursively copy the directory and all its contents to the target path.</>cwd()— Return a new path pointing to the current working directory.</>exists(follow_symlinks)— Whether this path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern,case_sensitive)— Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern. </>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()— True if the path is absolute (has both a root and, if applicable,a drive). </>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()— Whether this path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()— Whether this path is a regular file (also True for symlinks pointingto regular files). </>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()— Whether this path is a symbolic link.</>iterdir()— Yield path objects of the directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(path_pattern,case_sensitive)— Return True if this path matches the given pattern.</>mkdir(mode,parents,exist_ok)— Create a new directory at this given path.</>open(mode,buffering,encoding,errors,newline)— Open the file pointed to by this path and return a file object, asthe built-in open() function does. </>owner()— Return the login name of the file owner.</>read_bytes()— Open the file in bytes mode, read it, and close the file.</>read_text(encoding,errors)— Open the file in text mode, read it, and close the file.</>readlink()— Return the path to which the symbolic link points.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(PanPath) — Rename the file or directory to target.</>replace(target)— Rename this path to the target path, overwriting if that path exists.</>resolve(strict)— Make the path absolute, resolving all symlinks on the way and alsonormalizing it. </>rglob(pattern,case_sensitive)— Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree. </>rmdir()— Remove empty directory.</>rmtree()— Recursively remove directory and its contents.</>samefile(other_path)— Return whether other_path is the same or not as this file(as returned by os.path.samefile()). </>stat(follow_symlinks)— Return the result of the stat() system call on this path, likeos.stat() does. </>symlink_to(target,target_is_directory)— Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink. </>touch(mode,exist_ok)— Create this file with the given access mode, if it doesn't exist.</>unlink(missing_ok)— Remove this file or link.If the path is a directory, use rmdir() instead. </>walk(*args,**kwargs)(Iterator) — Walk the directory tree.</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Open the file in bytes mode, write to it, and close the file.</>write_text(data,encoding,errors,newline)— Open the file in text mode, write to it, and close the file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
__str__()
Return the string representation of the path, suitable forpassing to system calls.
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
as_uri()
Return the path as a 'file' URI.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_absolute()
True if the path is absolute (has both a root and, if applicable,a drive).
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
match(path_pattern, case_sensitive=None)
Return True if this path matches the given pattern.
stat(follow_symlinks=True)
Return the result of the stat() system call on this path, likeos.stat() does.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
exists(follow_symlinks=True)
Whether this path exists.
This method normally follows symlinks; to check whether a symlink exists, add the argument follow_symlinks=False.
is_dir()
Whether this path is a directory.
is_file()
Whether this path is a regular file (also True for symlinks pointingto regular files).
is_mount()
Check if this path is a mount point
is_symlink()
Whether this path is a symbolic link.
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
samefile(other_path)
Return whether other_path is the same or not as this file(as returned by os.path.samefile()).
open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open the file pointed to by this path and return a file object, asthe built-in open() function does.
read_bytes()
Open the file in bytes mode, read it, and close the file.
read_text(encoding=None, errors=None)
Open the file in text mode, read it, and close the file.
write_bytes(data)
Open the file in bytes mode, write to it, and close the file.
write_text(data, encoding=None, errors=None, newline=None)
Open the file in text mode, write to it, and close the file.
iterdir()
Yield path objects of the directory contents.
The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.
glob(pattern, case_sensitive=None)
Iterate over this subtree and yield all existing files (of anykind, including directories) matching the given relative pattern.
rglob(pattern, case_sensitive=None)
Recursively yield all existing files (of any kind, includingdirectories) matching the given relative pattern, anywhere in this subtree.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
absolute()
Return an absolute version of this path by prepending the currentworking directory. No normalization or symlink resolution is performed.
Use resolve() to get the canonical path to a file.
resolve(strict=False)
Make the path absolute, resolving all symlinks on the way and alsonormalizing it.
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
readlink()
Return the path to which the symbolic link points.
touch(mode=438, exist_ok=True)
Create this file with the given access mode, if it doesn't exist.
mkdir(mode=511, parents=False, exist_ok=False)
Create a new directory at this given path.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
unlink(missing_ok=False)
Remove this file or link.If the path is a directory, use rmdir() instead.
replace(target)
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.Note the order of arguments (link, target) is the reverse of os.symlink.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
a_touch(mode=438, exist_ok=True)
Create the file if it does not exist or update the modification time (async).
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raises an error if the file already exists.
a_rename(target)
Rename the file or directory to target.
target(Union) — New path
New path instance
a_replace(target)
Rename the file or directory to target, overwriting if target exists.
target(Union) — New path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
a_walk()
Asynchronously walk the directory tree.
A list of tuples (dirpath, dirnames, filenames)
a_readlink()
Asynchronously read the target of a symbolic link.
The path to which the symbolic link points.
a_symlink_to(target, target_is_directory=False)
Asynchronously create a symbolic link pointing to target.
target(Union) — The target path the symbolic link points to.target_is_directory(bool, optional) — Whether the target is a directory.
a_glob(pattern)
Asynchronously yield paths matching the glob pattern.
pattern(str) — Glob pattern (relative)
Matching LocalPath instances
a_rglob(pattern)
Recursively yield all existing files matching the given pattern.
pattern(str) — Glob pattern (relative)
Matching LocalPath instances
a_exists() → bool
Check if path exists (async).
a_is_file() → bool
Check if path is a file (async).
a_is_dir() → bool
Check if path is a directory (async).
a_read_bytes() → bytes
Read file as bytes (async).
a_read_text(encoding='utf-8') → str
Read file as text (async).
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data) → int
Write bytes to file (async).
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file (async).
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_is_symlink() → bool
Check if path is a symlink (async).
a_unlink(missing_ok=False)
Delete file (async).
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create directory (async).
mode(int, optional) — Directory mode (permissions) to set.parents(bool, optional) — If True, create parent directories as needed.exist_ok(bool, optional) — If True, does not raise an error if the directory already exists.
a_rmdir()
Remove empty directory (async).
a_rmtree()
Recursively remove directory and its contents (async).
a_iterdir() → AsyncGenerator
List directory contents (async).
a_stat(follow_symlinks=True) → stat_result
Get file stats (async).
a_open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
Open file and return async file handle.
mode(str, optional) — Mode to open the file (e.g., 'r', 'rb', 'w', 'wb').encoding(Optional, optional) — Text encoding to use (default: 'utf-8').
Async file handle from aiofiles
rename(target)
Rename the file or directory to target.
target(Union) — New path
New path instance
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If True, follow symbolic links
Target path instance
copytree(target, follow_symlinks=True)
Recursively copy the directory and all its contents to the target path.
target(Union) — Destination PanPath to copy to.follow_symlinks(bool, optional) — If True, copies the contents of symlinks.
The copied PanPath instance.
rmdir()
Remove empty directory.
rmtree()
Recursively remove directory and its contents.
walk(*args, **kwargs)
Walk the directory tree.
A list of tuples (dirpath, dirnames, filenames)
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
xqute.path.SpecCloudPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec cloud path
This class represents a cloud storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> spec_path = SpecPath("gs://bucket/file.txt",... mounted="gs://container-bucket/file.txt")
>>> str(spec_path)
'gs://bucket/file.txt'
>>> str(spec_path.mounted)
'gs://container-bucket/file.txt'
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
a_write_bytes(data)
Write bytes to file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
a_unlink(missing_ok=False)
Delete file.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
path(str | pathlib.path) — The path string or object representing the spec path.*args(Any) — Additional positional arguments passed to the path constructor.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.**kwargs(Any) — Additional keyword arguments passed to the path constructor.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecGSPath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec Google Cloud Storage path
This class represents a Google Cloud Storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> spec_path = SpecPath("gs://bucket/file.txt",... mounted="gs://container-bucket/file.txt")
>>> isinstance(spec_path, SpecGSPath)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_unlink(missing_ok=False)
Delete file.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecAzurePath(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec Azure Blob Storage path
This class represents an Azure Blob Storage path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> spec_path = SpecPath("az://container/blob",... mounted="az://remote-container/blob")
>>> isinstance(spec_path, SpecAzurePath)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_unlink(missing_ok=False)
Delete file.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.
xqute.path.SpecS3Path(path, *args, mounted=None, **kwargs) → xqute.path.speclocalpath | xqute.path.speccloudpath
A class to represent a spec Amazon S3 path
This class represents an Amazon S3 path as it appears in the local environment where the framework runs, while maintaining a reference to its corresponding path in the remote execution environment.
_mounted— The corresponding path in the remote execution environment.anchor— The concatenation of the drive and root, or ''.</>async_client(AsyncClient) — Get or create the async client for this path.</>client(SyncClient) — Get or create the sync client for this path.</>cloud_prefix(str) — Return the cloud prefix (e.g., 's3://bucket').</>drive— The drive prefix (letter or UNC path), if any.</>key(str) — Return the key/blob name without the cloud prefix.</>mounted— Get the corresponding mounted path in the remote environment.</>name— The final path component, if any.</>parent— Get the parent directory of this path.</>parents— A sequence of this path's logical parents.</>parts— An object providing sequence-like access to thecomponents in the filesystem path. </>root— The root of the path, if any.</>stem— The final path component, minus its last suffix.</>suffix— The final component's last suffix, if any.
This includes the leading period. For example: '.txt' </>suffixes— A list of the final component's suffixes, if any.
These include the leading periods. For example: ['.tar', '.gz'] </>
>>> spec_path = SpecPath("s3://bucket/key",... mounted="s3://remote-bucket/key")
>>> isinstance(spec_path, SpecS3Path)
True
__bytes__()— Return the bytes representation of the path. This is onlyrecommended to use under Unix. </>__eq__(other)(bool) — Check equality with another path object.</>__fspath__()(str) — Return the filesystem path representation.</>__hash__()(int) — Generate a hash for the SpecPath.</>__new__(cls,path,*args,mounted,**kwargs)(An instance of the appropriate SpecPath subclass based on the path type) — Factory method to create the appropriate SpecPath subclass instance.</>__repr__()(str) — Generate a string representation of the SpecPath.</>__rtruediv__(other)(CloudPath) — Right join paths while preserving type and client.</>__str__()(str) — Return properly formatted cloud URI with double slash.</>__truediv__(key)(SpecPath) — Implement the / operator for paths.</>a_copy(target,follow_symlinks)(PanPath) — Copy file to target.</>a_copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>a_exists()(bool) — Check if path exists.</>a_glob(pattern)(AsyncGenerator) — Glob for files matching pattern.</>a_is_dir()(bool) — Check if path is a directory.</>a_is_file()(bool) — Check if path is a file.</>a_is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>a_iterdir()(AsyncGenerator) — List directory contents (async version returns list).</>a_mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>a_open(mode,encoding,**kwargs)(AsyncFileHandle) — Open file and return async file handle.</>a_read_bytes()(bytes) — Read file as bytes.</>a_read_text(encoding)(str) — Read file as text.</>a_readlink()(CloudPath) — Read symlink target from metadata.</>a_rename(target)(CloudPath) — Rename/move file to target.</>a_replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>a_resolve()(PanPath) — Resolve to absolute path (no-op for cloud paths).</>a_rglob(pattern)(AsyncGenerator) — Recursively glob for files matching pattern.</>a_rmdir()— Remove empty directory marker.</>a_rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>a_stat(follow_symlinks)(Any) — Get file stats.</>a_symlink_to(target,target_is_directory)— Create symlink pointing to target (via metadata).</>a_touch(mode,exist_ok)— Create empty file.</>a_unlink(missing_ok)— Delete file.</>a_walk()(AsyncGenerator) — Walk directory tree (like os.walk).</>a_write_bytes(data)— Write bytes to file.</>a_write_text(data,encoding)(int) — Write text to file.</>absolute()(CloudPath) — Return absolute path - cloud paths are already absolute.</>as_posix()— Return the string representation of the path with forward (/)slashes. </>as_uri()(str) — Return the path as a URI (same as string representation).</>chmod(mode,follow_symlinks)— Change the permissions of the path, like os.chmod().</>copy(target,follow_symlinks)(CloudPath) — Copy file to target.</>copytree(target,follow_symlinks)(CloudPath) — Copy directory tree to target recursively.</>cwd()— Return a new path pointing to the current working directory.</>exists()(bool) — Check if path exists.</>expanduser()— Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser) </>get_fspath()(PanPath) — Get the corresponding local filesystem path and copy from cloud.</>glob(pattern)(Iterator) — Glob for files matching pattern.</>group()— Return the group name of the file gid.</>hardlink_to(target)— Make this path a hard link pointing to the same file as target.</>home()— Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')). </>is_absolute()(bool) — Cloud paths are always absolute.</>is_block_device()— Whether this path is a block device.</>is_char_device()— Whether this path is a character device.</>is_dir()(bool) — Check if path is a directory.</>is_fifo()— Whether this path is a FIFO.</>is_file()(bool) — Check if path is a file.</>is_junction()— Whether this path is a junction.</>is_mount()— Check if this path is a mount point</>is_relative_to(other,*_deprecated)— Return True if the path is relative to another path or False.</>is_reserved()— Return True if the path contains one of the special names reservedby the system, if any. </>is_socket()— Whether this path is a socket.</>is_symlink()(bool) — Check if this is a symbolic link (via metadata).</>iterdir()(CloudPath) — Iterate over directory contents.</>joinpath(*pathsegments)(SpecPath) — Join path components to this path.</>lchmod(mode)— Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's. </>lstat()— Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's. </>match(pattern)(bool) — Match path against glob pattern.</>mkdir(mode,parents,exist_ok)— Create a directory marker in cloud storage.</>open(mode,encoding,**kwargs)(Union) — Open file for reading/writing.</>owner()— Return the login name of the file owner.</>read_bytes()(bytes) — Read file as bytes.</>read_text(encoding)(str) — Read file as text.</>readlink()(CloudPath) — Read symlink target from metadata.</>relative_to(other,*_deprecated,walk_up)— Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError. </>rename(target)(CloudPath) — Rename/move file to target.</>replace(target)(CloudPath) — Replace file at target (overwriting if exists).</>resolve()(CloudPath) — Resolve to absolute path (no-op for cloud paths).</>rglob(pattern)(Iterator) — Recursively glob for files matching pattern.</>rmdir()— Remove empty directory marker.</>rmtree(ignore_errors,onerror)— Remove directory and all its contents recursively.</>samefile(other)(bool) — Check if this path refers to same file as other.</>stat(follow_symlinks)(Any) — Get file stats.</>symlink_to(target)— Create symlink pointing to target (via metadata).</>touch(exist_ok)— Create empty file.</>unlink(missing_ok)— Delete file.</>walk()(Iterator) — Walk directory tree (like os.walk).</>with_name(name)(SpecPath) — Return a new path with the name changed.</>with_segments(*pathsegments)— Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects are created from methods likeiterdir(). </>with_stem(stem)(SpecPath) — Return a new path with the stem changed.</>with_suffix(suffix)(SpecPath) — Return a new path with the suffix changed.</>write_bytes(data)— Write bytes to file.</>write_text(data,encoding)— Write text to file.</>
with_segments(*pathsegments)
Construct a new path object from any number of path-like objects.Subclasses may override this method to customize how new path objects
are created from methods like iterdir().
as_posix()
Return the string representation of the path with forward (/)slashes.
__bytes__()
Return the bytes representation of the path. This is onlyrecommended to use under Unix.
relative_to(other, *_deprecated, walk_up=False)
Return the relative path to another path identified by the passedarguments. If the operation is not possible (because this is not related to the other path), raise ValueError.
The walk_up parameter controls whether .. may be used to resolve
the path.
is_relative_to(other, *_deprecated)
Return True if the path is relative to another path or False.
is_reserved()
Return True if the path contains one of the special names reservedby the system, if any.
lstat()
Like stat(), except if the path points to a symlink, the symlink'sstatus information is returned, rather than its target's.
is_mount()
Check if this path is a mount point
is_junction()
Whether this path is a junction.
is_block_device()
Whether this path is a block device.
is_char_device()
Whether this path is a character device.
is_fifo()
Whether this path is a FIFO.
is_socket()
Whether this path is a socket.
cwd()
Return a new path pointing to the current working directory.
home()
Return a new path pointing to the user's home directory (asreturned by os.path.expanduser('~')).
owner()
Return the login name of the file owner.
group()
Return the group name of the file gid.
chmod(mode, follow_symlinks=True)
Change the permissions of the path, like os.chmod().
lchmod(mode)
Like chmod(), except if the path points to a symlink, the symlink'spermissions are changed, rather than its target's.
hardlink_to(target)
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link's.
expanduser()
Return a new path with expanded ~ and ~user constructs(as returned by os.path.expanduser)
__rtruediv__(other) → CloudPath
Right join paths while preserving type and client.
__str__() → str
Return properly formatted cloud URI with double slash.
exists() → bool
Check if path exists.
read_bytes() → bytes
Read file as bytes.
read_text(encoding='utf-8') → str
Read file as text.
write_bytes(data)
Write bytes to file.
write_text(data, encoding='utf-8')
Write text to file.
unlink(missing_ok=False)
Delete file.
iterdir() → CloudPath
Iterate over directory contents.
is_dir() → bool
Check if path is a directory.
is_file() → bool
Check if path is a file.
stat(follow_symlinks=True) → Any
Get file stats.
mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
open(mode='r', encoding=None, **kwargs) → Union
Open file for reading/writing.
absolute() → CloudPath
Return absolute path - cloud paths are already absolute.
is_absolute() → bool
Cloud paths are always absolute.
as_uri() → str
Return the path as a URI (same as string representation).
match(pattern) → bool
Match path against glob pattern.
Override to work correctly with cloud URIs by matching against the key portion of the path (excluding scheme and bucket).
glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
touch(exist_ok=True)
Create empty file.
exist_ok(bool, optional) — If False, raise error if file exists
rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
rmdir()
Remove empty directory marker.
resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
samefile(other)
Check if this path refers to same file as other.
other(Union) — Path to compare
True if paths are the same
is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
readlink()
Read symlink target from metadata.
Path that this symlink points to
symlink_to(target)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)
rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_exists() → bool
Check if path exists.
a_read_bytes() → bytes
Read file as bytes.
a_read_text(encoding='utf-8') → str
Read file as text.
encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_write_bytes(data)
Write bytes to file.
data(bytes) — Bytes to write to the file.
a_write_text(data, encoding='utf-8') → int
Write text to file.
data(str) — Text to write to the file.encoding(str, optional) — Text encoding to use (default: 'utf-8')
a_unlink(missing_ok=False)
Delete file.
missing_ok(bool, optional) — If True, does not raise an error if the file does not exist.
a_iterdir() → AsyncGenerator
List directory contents (async version returns list).
a_is_dir() → bool
Check if path is a directory.
a_is_file() → bool
Check if path is a file.
a_stat(follow_symlinks=True) → Any
Get file stats.
a_mkdir(mode=511, parents=False, exist_ok=False)
Create a directory marker in cloud storage.
In cloud storage (S3, GCS, Azure), directories are implicit. This method creates an empty object with a trailing slash to serve as a directory marker.
mode(int, optional) — Ignored (for compatibility with pathlib)parents(bool, optional) — If True, create parent directories as neededexist_ok(bool, optional) — If True, don't raise error if directory already exists
a_glob(pattern)
Glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", "/.py")
List of matching paths
a_rglob(pattern)
Recursively glob for files matching pattern.
pattern(str) — Pattern to match (e.g., ".txt", ".py")
List of matching paths (recursive)
a_walk()
Walk directory tree (like os.walk).
List of (dirpath, dirnames, filenames) tuples
a_touch(mode=438, exist_ok=True)
Create empty file.
mode(int, optional) — File mode (permissions) to set if creating the file.exist_ok(bool, optional) — If False, raise error if file exists
a_rename(target)
Rename/move file to target.
Can move between cloud and local paths.
target(Union) — New path (can be cloud or local)
New path instance
a_replace(target)
Replace file at target (overwriting if exists).
target(Union) — Target path
New path instance
a_resolve()
Resolve to absolute path (no-op for cloud paths).
Self (cloud paths are already absolute)
a_rmdir()
Remove empty directory marker.
a_is_symlink()
Check if this is a symbolic link (via metadata).
True if symlink metadata exists
a_readlink()
Read symlink target from metadata.
Path that this symlink points to
a_symlink_to(target, target_is_directory=False)
Create symlink pointing to target (via metadata).
target(Union) — Path this symlink should point to (absolute with scheme or relative)target_is_directory(bool, optional) — Ignored (for compatibility with pathlib)
a_rmtree(ignore_errors=False, onerror=None)
Remove directory and all its contents recursively.
ignore_errors(bool, optional) — If True, errors are ignoredonerror(Optional, optional) — Callable that accepts (function, path, excinfo)
a_copy(target, follow_symlinks=True)
Copy file to target.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)
Target path instance
a_copytree(target, follow_symlinks=True)
Copy directory tree to target recursively.
Can copy between cloud and local paths.
target(Union) — Destination path (can be cloud or local)follow_symlinks(bool, optional) — If False, symlinks are copied as symlinks (not dereferenced)
Target path instance
a_open(mode='r', encoding=None, **kwargs)
Open file and return async file handle.
mode(str, optional) — File mode (e.g., 'r', 'w', 'rb', 'wb')encoding(Optional, optional) — Text encoding (for text modes)**kwargs(Any) — Additional arguments passed to the async client
Async file handle from the async client
__new__(cls, path, *args, mounted=None, **kwargs)
Factory method to create the appropriate SpecPath subclass instance.
*args(Any) — Additional positional arguments passed to the path constructor.**kwargs(Any) — Additional keyword arguments passed to the path constructor.path(str | pathlib.path) — The path string or object representing the spec path.mounted(str | pathlib.path | none, optional) — The path string or object representing the corresponding mountedpath. If None, the spec path itself will be used as the mounted path.
ss s s
__repr__()
Generate a string representation of the SpecPath.
A string showing the class name, path, and mounted path (if different).
__eq__(other)
Check equality with another path object.
Two SpecPath objects are equal if they have the same path string and the same mounted path string.
other(Any) — Another object to compare with.
True if the paths are equal, False otherwise.
__hash__()
Generate a hash for the SpecPath.
A hash value based on the path string and mounted path string.
with_name(name)
Return a new path with the name changed.
name— The new name for the path.
A new spec path with the name changed in both the spec path and mounted path.
with_suffix(suffix)
Return a new path with the suffix changed.
suffix— The new suffix for the path.
A new spec path with the suffix changed in both the spec path and mounted path.
with_stem(stem)
Return a new path with the stem changed.
The stem is the filename without the suffix.
stem— The new stem for the path.
A new spec path with the stem changed in both the spec path and mounted path.
joinpath(*pathsegments)
Join path components to this path.
*pathsegments— The path segments to append to this path.
A new spec path with the segments appended to both the spec path and mounted path.
__truediv__(key)
Implement the / operator for paths.
key— The path segment to append to this path.
A new spec path with the segment appended.
__fspath__()
Return the filesystem path representation.
The filesystem path as a string.
get_fspath()
Get the corresponding local filesystem path and copy from cloud.
The path as it appears in the local filesystem.