Code reference#

fastrpi Package#

checks Module#

class fastrpi.checks.MacroNodePackageChecks(package: MacroNodePackage)#

Bases: ToolPackageChecks

Checks to assure proper formatting and functionality of the tool packages. These checks are run before publishing and in the CI/CD pipeline.

run_checks() None#

Run all checks.

Raises FastrPIPublishTestError when a test fails. Raises FastrPIPublishError when the user cancels publishing.

class fastrpi.checks.NetworkPackageChecks(package: NetworkPackage)#

Bases: PackageChecks

Checks to assure proper formatting and functionality of the network packages. These checks are run before publishing and in the CI/CD pipeline.

run_checks() None#

Run all checks.

Raises FastrPIPublishTestError when a test fails.

class fastrpi.checks.PackageChecks(package: Package)#

Bases: object

Checks to assure proper formatting and functionality of the packages. These checks are run before publishing and in the CI/CD pipeline.

This class can be subclassed to implement specific checks for different package types.

abstract run_checks() None#

Run the checks.

class fastrpi.checks.ToolPackageChecks(package: ToolPackage)#

Bases: PackageChecks

Checks to assure proper formatting and functionality of the tool packages. These checks are run before publishing and in the CI/CD pipeline.

run_checks() None#

Run all checks.

Raises FastrPIPublishTestError when a test fails. Raises FastrPIPublishError when the user cancels publishing.

config Module#

class fastrpi.config.Config(config_file: Path | str | None = None)#

Bases: object

Configuration class for FastrPI.

Contains information on the home folder and remote repositories.

write(attribute) None#

exceptions Module#

exception fastrpi.exceptions.FastrPIAlreadyInstalled(*args, **kwargs)#

Bases: FastrPIInstallError

exception fastrpi.exceptions.FastrPICreateError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPIDockerError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPIError(*args, **kwargs)#

Bases: Exception

This is the base class for all FastrPI related exceptions. Catching this class of exceptions should ensure a proper execution of FastrPI.

excerpt()#

Return an excerpt of the Error as a tuple.

exception fastrpi.exceptions.FastrPIGitError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPIInputError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPIInstallError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPIManifestError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPINotInstalled(*args, **kwargs)#

Bases: FastrPIInstallError

exception fastrpi.exceptions.FastrPIPublishError(*args, **kwargs)#

Bases: FastrPIError

exception fastrpi.exceptions.FastrPIPublishTestError(*args, **kwargs)#

Bases: FastrPIPublishError

exception fastrpi.exceptions.FastrPIRunError(*args, **kwargs)#

Bases: FastrPIError

helpers Module#

fastrpi.helpers.check_valid_yaml(path: Path) bool#

Check if the YAML file at path is valid YAML and can be loaded.

Parameters:

path – Path to a YAML file.

Returns:

True if valid, False if not.

fastrpi.helpers.load_module_from_file(filepath: Path, module_name: str)#

Loads Python file as module. Used in the run command.

Parameters:
  • filepath – Python file

  • module_name – Name to give the module.

Return mymodule:

Loaded module.

fastrpi.helpers.read_yaml(yaml_path: Path) dict#

Read in a YAML file.

Parameters:

yaml_path – Path to the YAML file.

Return data:

Dictionary.

fastrpi.helpers.walk_dict_list(d)#
fastrpi.helpers.write_yaml(data: dict, yaml_path: Path) None#

Write to a YAML file.

Parameters:
  • data – Data to write

  • yaml_path – Path to the YAML file.

manifest Module#

class fastrpi.manifest.MacroNodeManifest(manifest_path: Path | str, **kwargs)#

Bases: Manifest

class fastrpi.manifest.Manifest(manifest_path: Path | str, **kwargs)#

Bases: UserDict

Manifest object

Contains the content of the package manifest. After the manifest YAML file is loaded, the data is stored in this object as if it were a dictionary. Derivative variables are accessed through property methods.

property container: Dict[str, str] | None#

Information on the associated Docker container for the appropriate package_type. Returns None when package_type has no associated container.

Returns:

Dictionary with keys name, version, image and dockerurl or None

classmethod create(manifest_path: Path | str) Manifest#
property files: List[Path]#

List of files which are part of the package. Predominantly used for moving and copying these files.

run_checks() None#

Run checks to validate the manifest file.

subclasses = {'macronode': <class 'fastrpi.manifest.MacroNodeManifest'>, 'network': <class 'fastrpi.manifest.NetworkManifest'>, 'tool': <class 'fastrpi.manifest.ToolManifest'>}#
update_file() None#

Update manifest YAML file after changing it.

class fastrpi.manifest.NetworkManifest(manifest_path: Path | str, **kwargs)#

Bases: Manifest

class fastrpi.manifest.ToolManifest(manifest_path: Path | str, **kwargs)#

Bases: Manifest

property container: Dict[str, str]#

Information on the associated Docker container for the appropriate package_type. Raises FastrPIDockerError when package_type has no associated container.

Returns:

Dictionary with keys name, version, image and ‘dockerurl’.

package Module#

class fastrpi.package.MacroNodePackage(manifest: Manifest)#

Bases: ToolPackage

package_type = 'MacroNode'#
class fastrpi.package.NetworkPackage(manifest: Manifest)#

Bases: Package

copy_source_sink(dest_folder)#
package_type = 'Network'#
run(source_sink_path: Path, tmp_dir: Path) None#
class fastrpi.package.Package(manifest: Manifest)#

Bases: object

copy_files(dest_folder)#
classmethod create(manifest: Manifest) Package#
classmethod make_tag(info: PackageInfo) str#
property name: str#
package_type = 'Package'#
property package_version: str#
run_checks()#
subclasses = {'macronode': <class 'fastrpi.package.MacroNodePackage'>, 'network': <class 'fastrpi.package.NetworkPackage'>, 'tool': <class 'fastrpi.package.ToolPackage'>}#
property tag: str#
class fastrpi.package.ToolPackage(manifest: Manifest)#

Bases: Package

package_type = 'Tool'#
property version: str#

packageinfo Module#

class fastrpi.packageinfo.PackageInfo(name: str, package_version: str, version: str | None = None)#

Bases: object

classmethod from_dict(info: dict) PackageInfo#
property tag#

record Module#

class fastrpi.record.InstallRecord(config: Config)#

Bases: object

Install Record

The InstallRecord object keeps track of the installed packages.

add(package: Package) None#
check_installed(package_info: PackageInfo) bool#
property installed_packages: List[PackageInfo]#
load_package(package_info: PackageInfo) Package#
remove(package_tag: str) None#
class fastrpi.record.NetworkInstallRecord(config: Config)#

Bases: InstallRecord

class fastrpi.record.ToolInstallRecord(config: Config)#

Bases: InstallRecord

add(package: ToolPackage) None#

repository Module#

class fastrpi.repository.NetworkPackageRepository(config: Config)#

Bases: PackageRepository

property avail_packages: List[PackageInfo]#
install(package_info: PackageInfo) None#
class fastrpi.repository.PackageRepository(config: Config)#

Bases: object

Package repository API

To encapsulate the technical implementation of the package storage, the PackageRepository objects are used to form a facade.

property avail_packages: List#
property avail_packages_info: List[PackageInfo]#
check_available(package_info: PackageInfo) bool#
abstract install(package_info: PackageInfo) Package#
publish(package: Package) None#
class fastrpi.repository.ToolPackageRepository(config: Config)#

Bases: PackageRepository

property avail_datatypes: List#
property avail_packages: List[PackageInfo]#
install(package_info: PackageInfo) None#
install_macronode(manifest: Manifest) None#

repositorybackend Module#

class fastrpi.repositorybackend.ContainerRepository(config: Config)#

Bases: RepositoryBackEnd

pull(container_info: dict) None#
class fastrpi.repositorybackend.DockerRepositoryBackEnd(config: Config)#

Bases: ContainerRepository

pull(container_info: dict) None#

Retrieves the Docker image for a tool.

Parameters:

container_info – Dictionary containing information on the container.

class fastrpi.repositorybackend.GitRepository(config: Config)#

Bases: RepositoryBackEnd

add_origin() None#

Adds remote repository URL under the name origin.

checkout_main() None#

Checks out the main branch of the repository. Currently this is master.

checkout_tag(tag: str) None#

Checks out a tagged commit. This process is canceled when the tag cannot be found locally. Raises an exception when the checkout process fails.

Parameters:

tag – Tag to checkout.

create_draft_branch(tag: str) None#
delete_draft_branch() None#
fetch_origin() None#

Fetches the remote repository at origin. Raises an exception when the remote repository cannot be fetched.

property filelist: List[Path]#
abstract folder_path(package_info: PackageInfo) Path#
folder_path_package(package: Package) Path#
property git_direct#

Produces an object to directly access Git functionality.

pull(package_info: PackageInfo) Manifest#

Retrieves a package from the repository by checking out the corresponding folder using sparse checkout.

Parameters:

package_info – Package info

pull_origin() None#

Pulls the remote repository at origin. Raises an exception when the remote repository cannot be pulled.

push(package: Package) None#
remove_sparse_checkout(name: str) None#

Removes folder from sparse checkout if present.

Parameters:

name – Folder to be removed from sparse checkout.

property repository#
class fastrpi.repositorybackend.NetworkGitRepository(config: Config)#

Bases: GitRepository

folder_path(package_info: PackageInfo) Path#
property installed_list: List[PackageInfo] | List[Any]#
class fastrpi.repositorybackend.RepositoryBackEnd(config: Config)#

Bases: object

Package repository back-end

All RepositoryBackEnd objects currently contain the implementation of the local and remote storage of the packages.

class fastrpi.repositorybackend.SingularityRepositoryBackEnd(config: Config)#

Bases: ContainerRepository

pull(container_info: dict) None#

Retrieves the Docker image for a tool.

Parameters:

container_info – Dictionary containing information on the container.

class fastrpi.repositorybackend.SingularitySlurmRepositoryBackEnd(config: Config)#

Bases: SingularityRepositoryBackEnd

pull(container_info: dict) None#

Retrieves the Docker image for a tool.

Parameters:

container_info – Dictionary containing information on the container.

class fastrpi.repositorybackend.ToolGitRepository(config: Config)#

Bases: GitRepository

folder_path(package_info: PackageInfo) Path#
property installed_list: List[PackageInfo] | List[Any]#
pull_origin() None#

Pulls the remote repository at origin. Raises an exception when the remote repository cannot be pulled.