galaxy.files.sources package
- class galaxy.files.sources.PluginKind(value)[source]
-
Enum to distinguish between different kinds or categories of plugins.
- rfs = 'rfs'
Remote File System
A remote file system is a file source that is backed by a remote file system that is accessible via a URI. Examples include FTP, SFTP, S3, etc.
- drs = 'drs'
Data Repository Service
A data repository service is a file source that is backed by a remote data repository service implementing the (DRS) API which provides a generic interface to data repositories so data consumers, including workflow systems, can access data in a single, standard way regardless of where it’s stored and how it’s managed.
- rdm = 'rdm'
Research Data Management
A research data management file source is a file source that is backed by a remote research data management system that can provide DOIs. Examples include InvenioRDM, Zenodo, etc.
- stock = 'stock'
Stock Plugin
A stock plugin is a file source that is shipped with Galaxy and covers common use cases. Examples include the UserFTP, LibraryImport, UserLibraryImport, etc.
- class galaxy.files.sources.FileSourceSupports[source]
Bases:
TypedDict
Feature support flags for a file source plugin
- class galaxy.files.sources.FilesSourceProperties[source]
Bases:
TypedDict
Initial set of properties used to initialize a filesource.
Filesources can extend this typed dict to define any additional filesource specific properties.
- file_sources_config: typing_extensions.NotRequired[FileSourcePluginsConfig]
- supports: typing_extensions.NotRequired[FileSourceSupports]
- class galaxy.files.sources.FilesSourceOptions(writeable: bool | None = False, extra_props: ~galaxy.files.sources.FilesSourceProperties | None = <factory>)[source]
Bases:
object
Options to control behavior of file source operations, such as realize_to, write_from and list.
- extra_props: FilesSourceProperties | None
- class galaxy.files.sources.EntryData[source]
Bases:
TypedDict
Provides data to create a new entry in a file source.
- class galaxy.files.sources.Entry[source]
Bases:
TypedDict
Represents the result of creating a new entry in a file source.
- class galaxy.files.sources.TDirectoryClass
Bases:
TypedDict
- class galaxy.files.sources.RemoteDirectory[source]
Bases:
RemoteEntry
,TDirectoryClass
- class galaxy.files.sources.RemoteFile[source]
Bases:
RemoteEntry
,TFileClass
- class: typing_extensions.Literal[File]
- class galaxy.files.sources.SingleFileSource[source]
Bases:
object
Represents a protocol handler for a single remote file that can be read by or written to by Galaxy. A remote file source can typically handle a url like https://galaxyproject.org/myfile.txt or drs://myserver/123456. The filesource abstraction allows programmatic control over the specific source to access, injection of credentials and access control. Filesources are typically listed and configured through file_sources_conf.yml or programmatically, as required.
Filesources can be contextualized with a user_context, which contains information related to the current user attempting to access that filesource such as the username, preferences, roles etc., which can then be used by the filesource to make authorization decisions or inject credentials.
Filesources are loaded through Galaxy’s plugin system in galaxy.util.plugin_config.
- abstract user_has_access(user_context: OptionalUserContext) bool [source]
Return a boolean indicating whether the user can access the FileSource.
- abstract realize_to(source_path: str, native_path: str, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None)[source]
Realize source path (relative to uri root) to local file system path.
- Parameters:
source_path (str) – url of the source file to copy from. e.g. https://galaxyproject.org/myfile.txt
native_path (str) – local path to write to. e.g. /tmp/myfile.txt
user_context (OptionalUserContext, optional) – A user context , defaults to None
opts (Optional[FilesSourceOptions], optional) – A set of options to exercise additional control over the realize_to method. Filesource specific, defaults to None
- abstract write_from(target_path: str, native_path: str, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None)[source]
Write file at native path to target_path (relative to uri root).
- Parameters:
target_path (str) – url of the target file to write to within the filesource. e.g. gxfiles://myftp1/myfile.txt
native_path (str) – The local file to read. e.g. /tmp/myfile.txt
user_context (_type_, optional) – A user context , defaults to None
opts (Optional[FilesSourceOptions], optional) – A set of options to exercise additional control over the write_from method. Filesource specific, defaults to None
- abstract score_url_match(url: str) int [source]
Return how well a given url matches this filesource. A score greater than zero indicates that this filesource is capable of processing the given url.
Scoring is based on the following rules: a. The maximum score will be the length of the url. b. The minimum score will be the length of the scheme if the filesource can handle the file. c. The score will be zero if the filesource cannot handle the file.
For example, given the following file source config: - type: webdav
id: cloudstor url: “https://cloudstor.aarnet.edu.au” root: “/plus/remote.php/webdav”
type: http id: generic_http
the generic http handler may return a score of 8 for the url https://cloudstor.aarnet.edu.au/plus/remote.php/webdav/myfolder/myfile.txt, as it can handle only the scheme part of the url. A webdav handler may return a score of 55 for the same url, as both the webdav url and root combined are a specific match.
- abstract to_relative_path(url: str) str [source]
Convert this url to a filesource relative path. For example, given the url gxfiles://mysource1/myfile.txt it will return /myfile.txt. Protocols directly understood by the handler need not be relativized. For example, the url s3://bucket/myfile.txt can be returned unchanged.
- abstract to_dict(for_serialization=False, user_context: OptionalUserContext = None) FilesSourceProperties [source]
Return a dictified representation of this FileSource instance.
If
user_context
is supplied, properties should be written so user context doesn’t need to be present after the plugin is re-hydrated.
- class galaxy.files.sources.SupportsBrowsing[source]
Bases:
object
An interface indicating that this filesource is browsable.
Browsable filesources will typically have a root uri from which to start browsing. e.g. In an s3 bucket, the root uri may be gxfiles://bucket1/
They will also have a list method to list files in a specific path within the filesource.
- abstract list(path='/', recursive=False, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None, limit: int | None = None, offset: int | None = None, query: str | None = None, sort_by: str | None = None) Tuple[List[RemoteDirectory | RemoteFile], int] [source]
Return a list of ‘Directory’s and ‘File’s and the total count in a tuple.
- class galaxy.files.sources.FilesSource[source]
Bases:
SingleFileSource
,SupportsBrowsing
Represents a combined interface for single or browsable filesources. The get_browsable method can be used to determine whether the filesource is browsable and implements the SupportsBrowsing interface.
- galaxy.files.sources.file_source_type_is_browsable(target_type: Type[BaseFilesSource]) bool [source]
- class galaxy.files.sources.BaseFilesSource[source]
Bases:
FilesSource
- plugin_kind: ClassVar[PluginKind] = 'rfs'
- get_browsable() bool [source]
Return true if the filesource implements the SupportsBrowsing interface.
- user_has_access(user_context: OptionalUserContext) bool [source]
Return a boolean indicating whether the user can access the FileSource.
- to_relative_path(url: str) str [source]
Convert this url to a filesource relative path. For example, given the url gxfiles://mysource1/myfile.txt it will return /myfile.txt. Protocols directly understood by the handler need not be relativized. For example, the url s3://bucket/myfile.txt can be returned unchanged.
- score_url_match(url: str) int [source]
Return how well a given url matches this filesource. A score greater than zero indicates that this filesource is capable of processing the given url.
Scoring is based on the following rules: a. The maximum score will be the length of the url. b. The minimum score will be the length of the scheme if the filesource can handle the file. c. The score will be zero if the filesource cannot handle the file.
For example, given the following file source config: - type: webdav
id: cloudstor url: “https://cloudstor.aarnet.edu.au” root: “/plus/remote.php/webdav”
type: http id: generic_http
the generic http handler may return a score of 8 for the url https://cloudstor.aarnet.edu.au/plus/remote.php/webdav/myfolder/myfile.txt, as it can handle only the scheme part of the url. A webdav handler may return a score of 55 for the same url, as both the webdav url and root combined are a specific match.
- to_dict(for_serialization=False, user_context: OptionalUserContext = None) FilesSourceProperties [source]
Return a dictified representation of this FileSource instance.
If
user_context
is supplied, properties should be written so user context doesn’t need to be present after the plugin is re-hydrated.
- list(path='/', recursive=False, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None, limit: int | None = None, offset: int | None = None, query: str | None = None, sort_by: str | None = None) Tuple[List[RemoteDirectory | RemoteFile], int] [source]
Return a list of ‘Directory’s and ‘File’s and the total count in a tuple.
- create_entry(entry_data: EntryData, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None) Entry [source]
- write_from(target_path: str, native_path: str, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None)[source]
Write file at native path to target_path (relative to uri root).
- Parameters:
target_path (str) – url of the target file to write to within the filesource. e.g. gxfiles://myftp1/myfile.txt
native_path (str) – The local file to read. e.g. /tmp/myfile.txt
user_context (_type_, optional) – A user context , defaults to None
opts (Optional[FilesSourceOptions], optional) – A set of options to exercise additional control over the write_from method. Filesource specific, defaults to None
- realize_to(source_path: str, native_path: str, user_context: OptionalUserContext = None, opts: FilesSourceOptions | None = None)[source]
Realize source path (relative to uri root) to local file system path.
- Parameters:
source_path (str) – url of the source file to copy from. e.g. https://galaxyproject.org/myfile.txt
native_path (str) – local path to write to. e.g. /tmp/myfile.txt
user_context (OptionalUserContext, optional) – A user context , defaults to None
opts (Optional[FilesSourceOptions], optional) – A set of options to exercise additional control over the realize_to method. Filesource specific, defaults to None
Submodules
galaxy.files.sources.anvil module
galaxy.files.sources.basespace module
galaxy.files.sources.dropbox module
galaxy.files.sources.ftp module
- class galaxy.files.sources.ftp.FtpFilesSource(**kwd: ~typing_extensions.)[source]
Bases:
PyFilesystem2FilesSource
- required_module
alias of
FTPFS
- score_url_match(url: str)[source]
Return how well a given url matches this filesource. A score greater than zero indicates that this filesource is capable of processing the given url.
Scoring is based on the following rules: a. The maximum score will be the length of the url. b. The minimum score will be the length of the scheme if the filesource can handle the file. c. The score will be zero if the filesource cannot handle the file.
For example, given the following file source config: - type: webdav
id: cloudstor url: “https://cloudstor.aarnet.edu.au” root: “/plus/remote.php/webdav”
type: http id: generic_http
the generic http handler may return a score of 8 for the url https://cloudstor.aarnet.edu.au/plus/remote.php/webdav/myfolder/myfile.txt, as it can handle only the scheme part of the url. A webdav handler may return a score of 55 for the same url, as both the webdav url and root combined are a specific match.
galaxy.files.sources.galaxy module
Static Galaxy file sources - ftp and libraries.
- class galaxy.files.sources.galaxy.UserFtpFilesSource(**kwd: ~typing_extensions.)[source]
Bases:
PosixFilesSource
- plugin_kind: ClassVar[PluginKind] = 'stock'
- class galaxy.files.sources.galaxy.LibraryImportFilesSource(**kwd: ~typing_extensions.)[source]
Bases:
PosixFilesSource
- plugin_kind: ClassVar[PluginKind] = 'stock'
- class galaxy.files.sources.galaxy.UserLibraryImportFilesSource(**kwd: ~typing_extensions.)[source]
Bases:
PosixFilesSource
- plugin_kind: ClassVar[PluginKind] = 'stock'
galaxy.files.sources.googlecloudstorage module
galaxy.files.sources.googledrive module
galaxy.files.sources.onedata module
galaxy.files.sources.posix module
- class galaxy.files.sources.posix.PosixFilesSource(**kwd: ~typing_extensions.)[source]
Bases:
BaseFilesSource
- score_url_match(url: str)[source]
Return how well a given url matches this filesource. A score greater than zero indicates that this filesource is capable of processing the given url.
Scoring is based on the following rules: a. The maximum score will be the length of the url. b. The minimum score will be the length of the scheme if the filesource can handle the file. c. The score will be zero if the filesource cannot handle the file.
For example, given the following file source config: - type: webdav
id: cloudstor url: “https://cloudstor.aarnet.edu.au” root: “/plus/remote.php/webdav”
type: http id: generic_http
the generic http handler may return a score of 8 for the url https://cloudstor.aarnet.edu.au/plus/remote.php/webdav/myfolder/myfile.txt, as it can handle only the scheme part of the url. A webdav handler may return a score of 55 for the same url, as both the webdav url and root combined are a specific match.
- to_relative_path(url: str) str [source]
Convert this url to a filesource relative path. For example, given the url gxfiles://mysource1/myfile.txt it will return /myfile.txt. Protocols directly understood by the handler need not be relativized. For example, the url s3://bucket/myfile.txt can be returned unchanged.
galaxy.files.sources.s3 module
galaxy.files.sources.s3fs module
- class galaxy.files.sources.s3fs.S3FsFilesSource(**kwd: ~typing_extensions.)[source]
Bases:
BaseFilesSource
- score_url_match(url: str)[source]
Return how well a given url matches this filesource. A score greater than zero indicates that this filesource is capable of processing the given url.
Scoring is based on the following rules: a. The maximum score will be the length of the url. b. The minimum score will be the length of the scheme if the filesource can handle the file. c. The score will be zero if the filesource cannot handle the file.
For example, given the following file source config: - type: webdav
id: cloudstor url: “https://cloudstor.aarnet.edu.au” root: “/plus/remote.php/webdav”
type: http id: generic_http
the generic http handler may return a score of 8 for the url https://cloudstor.aarnet.edu.au/plus/remote.php/webdav/myfolder/myfile.txt, as it can handle only the scheme part of the url. A webdav handler may return a score of 55 for the same url, as both the webdav url and root combined are a specific match.