Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
galaxy.tool_util.deps package¶
Dependency management for tools.
- galaxy.tool_util.deps.build_dependency_manager(app_config_dict: Optional[Dict[str, Any]] = None, resolution_config_dict: Optional[Dict[str, Any]] = None, conf_file: Optional[str] = None, default_tool_dependency_dir: Optional[str] = None) DependencyManager [source]¶
Build a DependencyManager object from app and/or resolution config.
If app_config_dict is specified, it should be application configuration information and configuration options are generally named to identify the context of dependency management (e.g. conda_prefix not prefix or use_cached_dependency_manager not cache). resolution_config_dict if specified is assumed to be the to_dict() version of a DependencyManager and should only contain dependency configuration options.
- class galaxy.tool_util.deps.DependencyManager(default_base_path: str, conf_file: Optional[str] = None, app_config: Optional[Dict[str, Any]] = None)[source]¶
Bases:
object
A DependencyManager attempts to resolve named and versioned dependencies by searching for them under a list of directories. Directories should be of the form:
$BASE/name/version/…
and should each contain a file ‘env.sh’ which can be sourced to make the dependency available in the current shell environment.
- cached = False¶
- __init__(default_base_path: str, conf_file: Optional[str] = None, app_config: Optional[Dict[str, Any]] = None) None [source]¶
Create a new dependency manager looking for packages under the paths listed in base_paths. The default base path is app.config.tool_dependency_dir.
- set_enabled_container_types(container_types_to_destinations)[source]¶
Set the union of all enabled container types.
- property enabled_container_types¶
Returns the union of enabled container types.
- get_resolver_option(resolver, key, explicit_resolver_options=None)[source]¶
Look in resolver-specific settings for option and then fallback to global settings.
- property precache¶
- class galaxy.tool_util.deps.CachedDependencyManager(default_base_path, **kwd)[source]¶
Bases:
DependencyManager
- cached = True¶
- __init__(default_base_path, **kwd)[source]¶
Create a new dependency manager looking for packages under the paths listed in base_paths. The default base path is app.config.tool_dependency_dir.
- dependency_shell_commands(requirements, **kwds)[source]¶
Runs a set of requirements through the dependency resolvers and returns a list of commands required to activate the dependencies. If dependencies are cacheable and the cache does not exist, will try to create it. If cached environment exists or is successfully created, will generate commands to activate it.
- class galaxy.tool_util.deps.NullDependencyManager(default_base_path=None, conf_file=None, app_config=None)[source]¶
Bases:
DependencyManager
- cached = False¶
Subpackages¶
- galaxy.tool_util.deps.container_resolvers package
ResolutionCache
ContainerResolver
- Submodules
- galaxy.tool_util.deps.container_resolvers.explicit module
ExplicitContainerResolver
ExplicitSingularityContainerResolver
CachedExplicitSingularityContainerResolver
FallbackContainerResolver
FallbackSingularityContainerResolver
FallbackNoRequirementsContainerResolver
FallbackNoRequirementsSingularityContainerResolver
MappingContainerResolver
RequiresGalaxyEnvironmentContainerResolver
RequiresGalaxyEnvironmentSingularityContainerResolver
- galaxy.tool_util.deps.container_resolvers.mulled module
CachedMulledDockerContainerResolver
CachedMulledSingularityContainerResolver
MulledDockerContainerResolver
MulledDockerContainerResolver.resolver_type
MulledDockerContainerResolver.shell
MulledDockerContainerResolver.protocol
MulledDockerContainerResolver.__init__()
MulledDockerContainerResolver.cached_container_description()
MulledDockerContainerResolver.pull()
MulledDockerContainerResolver.can_list_containers
MulledDockerContainerResolver.resolve()
MulledSingularityContainerResolver
MulledSingularityContainerResolver.resolver_type
MulledSingularityContainerResolver.protocol
MulledSingularityContainerResolver.__init__()
MulledSingularityContainerResolver.cached_container_description()
MulledSingularityContainerResolver.can_list_containers
MulledSingularityContainerResolver.pull()
BuildMulledDockerContainerResolver
BuildMulledSingularityContainerResolver
- galaxy.tool_util.deps.mulled package
- Submodules
- galaxy.tool_util.deps.mulled.get_tests module
- galaxy.tool_util.deps.mulled.mulled_build module
- galaxy.tool_util.deps.mulled.mulled_build_channel module
- galaxy.tool_util.deps.mulled.mulled_build_files module
- galaxy.tool_util.deps.mulled.mulled_build_tool module
- galaxy.tool_util.deps.mulled.mulled_hash module
- galaxy.tool_util.deps.mulled.mulled_list module
- galaxy.tool_util.deps.mulled.mulled_search module
- galaxy.tool_util.deps.mulled.mulled_update_singularity_containers module
- galaxy.tool_util.deps.mulled.util module
- galaxy.tool_util.deps.resolvers package
DependencyResolver
DependencyResolver.dict_collection_visible_keys
DependencyResolver.disabled
DependencyResolver.resolves_simple_dependencies
DependencyResolver.config_options
DependencyResolver.read_only
DependencyResolver.resolve()
DependencyResolver.install_dependency()
DependencyResolver.can_uninstall_dependencies
MultipleDependencyResolver
ListableDependencyResolver
MappableDependencyResolver
RequirementMapping
SpecificationAwareDependencyResolver
SpecificationPatternDependencyResolver
Dependency
ContainerDependency
NullDependency
DependencyException
- Submodules
- galaxy.tool_util.deps.resolvers.brewed_tool_shed_packages module
- galaxy.tool_util.deps.resolvers.conda module
CondaDependencyResolver
CondaDependencyResolver.dict_collection_visible_keys
CondaDependencyResolver.resolver_type
CondaDependencyResolver.config_options
CondaDependencyResolver.__init__()
CondaDependencyResolver.clean()
CondaDependencyResolver.uninstall()
CondaDependencyResolver.uninstall_environments()
CondaDependencyResolver.install_all()
CondaDependencyResolver.resolve_all()
CondaDependencyResolver.merged_environment_name()
CondaDependencyResolver.resolve()
CondaDependencyResolver.unused_dependency_paths()
CondaDependencyResolver.list_dependencies()
CondaDependencyResolver.prefix
- galaxy.tool_util.deps.resolvers.galaxy_packages module
- galaxy.tool_util.deps.resolvers.homebrew module
- galaxy.tool_util.deps.resolvers.lmod module
- galaxy.tool_util.deps.resolvers.modules module
- galaxy.tool_util.deps.resolvers.resolver_mixins module
- galaxy.tool_util.deps.resolvers.tool_shed_packages module
- galaxy.tool_util.deps.resolvers.unlinked_tool_shed_packages module
Submodules¶
galaxy.tool_util.deps.brew_exts module¶
- class galaxy.tool_util.deps.brew_exts.RecipeContext(recipe, version, brew_context=None)[source]¶
Bases:
object
- property cellar_path¶
- exception galaxy.tool_util.deps.brew_exts.CommandLineException(command, stdout, stderr)[source]¶
Bases:
Exception
- galaxy.tool_util.deps.brew_exts.versioned_install(recipe_context, package=None, version=None, installed_deps=None)[source]¶
- galaxy.tool_util.deps.brew_exts.commit_for_version(recipe_context: RecipeContext, package, version)[source]¶
- galaxy.tool_util.deps.brew_exts.build_env_statements_from_recipe_context(recipe_context, **kwds)[source]¶
- galaxy.tool_util.deps.brew_exts.build_env_statements(cellar_root, cellar_path, relaxed=None, custom_only=False)[source]¶
- galaxy.tool_util.deps.brew_exts.build_env_actions(deps, cellar_root, cellar_path, relaxed=None, custom_only=False)[source]¶
- class galaxy.tool_util.deps.brew_exts.EnvAction(keg_root, action_description)[source]¶
Bases:
object
galaxy.tool_util.deps.brew_util module¶
brew_exts defines generic extensions to Homebrew this file builds on those abstraction and provides Galaxy specific functionality not useful to the brew external commands.
galaxy.tool_util.deps.commands module¶
galaxy.tool_util.deps.conda_compat module¶
Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality and should be utilized when available but that are only available in conda channels and not in PyPI. This module serves as a PyPI capable interface to these utilities.
- galaxy.tool_util.deps.conda_compat.MetaData¶
alias of
_MetaData
galaxy.tool_util.deps.conda_util module¶
- class galaxy.tool_util.deps.conda_util.CondaContext(conda_prefix: Optional[str] = None, conda_exec: Optional[str] = None, shell_exec: Optional[Callable[[...], int]] = None, debug: bool = False, ensure_channels: Union[str, List[str]] = '', condarc_override: Optional[str] = None, use_path_exec: bool = False, copy_dependencies: bool = False, use_local: bool = False)[source]¶
Bases:
InstallableContext
- installable_description = 'Conda'¶
- __init__(conda_prefix: Optional[str] = None, conda_exec: Optional[str] = None, shell_exec: Optional[Callable[[...], int]] = None, debug: bool = False, ensure_channels: Union[str, List[str]] = '', condarc_override: Optional[str] = None, use_path_exec: bool = False, copy_dependencies: bool = False, use_local: bool = False) None [source]¶
- can_install_conda() bool [source]¶
If conda_exec is set to a path outside of conda_prefix, there is no use installing conda into conda_prefix, since it can’t be used by galaxy. If conda_exec equals conda_prefix/bin/conda, we can install conda if either conda_prefix does not exist or is empty.
- exec_command(operation: str, args: List[str], stdout_path: Optional[str] = None) int [source]¶
Execute the requested command.
Return the process exit code (i.e. 0 in case of success).
- exec_create(args: Iterable[str], allow_local: bool = True, stdout_path: Optional[str] = None) int [source]¶
Return the process exit code (i.e. 0 in case of success).
- exec_remove(args: List[str]) int [source]¶
Remove a conda environment using conda env remove -y –name args.
Return the process exit code (i.e. 0 in case of success).
- exec_install(args: Iterable[str], allow_local: bool = True, stdout_path: Optional[str] = None) int [source]¶
Return the process exit code (i.e. 0 in case of success).
- exec_clean(args: Optional[List[str]] = None, quiet: bool = False) int [source]¶
Clean up after conda installation.
Return the process exit code (i.e. 0 in case of success).
- exec_search(args: List[str], json: bool = False, offline: bool = False, platform: Optional[str] = None) str [source]¶
Search conda channels for a package
Return the standard output of the conda process.
- class galaxy.tool_util.deps.conda_util.CondaTarget(package: str, version: Optional[str] = None, channel: Optional[str] = None)[source]¶
Bases:
object
- galaxy.tool_util.deps.conda_util.install_conda(conda_context: CondaContext, force_conda_build: bool = False) int [source]¶
- galaxy.tool_util.deps.conda_util.install_conda_target(conda_target: CondaTarget, conda_context: CondaContext, skip_environment: bool = False) int [source]¶
Install specified target into a its own environment.
Return the process exit code (i.e. 0 in case of success).
- galaxy.tool_util.deps.conda_util.requirements_to_conda_targets(requirements: Iterable[ToolRequirement]) List[CondaTarget] [source]¶
galaxy.tool_util.deps.container_classes module¶
- class galaxy.tool_util.deps.container_classes.Container(container_id, app_info, tool_info, destination_info, job_info, container_description, container_name=None)[source]¶
Bases:
object
- __init__(container_id, app_info, tool_info, destination_info, job_info, container_description, container_name=None)[source]¶
- property resolve_dependencies¶
- property shell¶
- property source_environment¶
- galaxy.tool_util.deps.container_classes.preprocess_volumes(volumes_raw_str, container_type)[source]¶
Process Galaxy volume specification string to either Docker or Singularity specification.
Galaxy allows the mount try “default_ro” which translates to ro for Docker and ro for Singularity iff no subdirectories are rw (Singularity does not allow ro parent directories with rw subdirectories).
>>> preprocess_volumes(None, DOCKER_CONTAINER_TYPE) [] >>> preprocess_volumes("", DOCKER_CONTAINER_TYPE) [] >>> preprocess_volumes("/a/b", DOCKER_CONTAINER_TYPE) ['/a/b:rw'] >>> preprocess_volumes("/a/b:ro,/a/b/c:rw", DOCKER_CONTAINER_TYPE) ['/a/b:ro', '/a/b/c:rw'] >>> preprocess_volumes("/a/b:/a:ro,/a/b/c:/a/b:rw", DOCKER_CONTAINER_TYPE) ['/a/b:/a:ro', '/a/b/c:/a/b:rw'] >>> preprocess_volumes("/a/b:default_ro,/a/b/c:rw", DOCKER_CONTAINER_TYPE) ['/a/b:ro', '/a/b/c:rw'] >>> preprocess_volumes("/a/b:default_ro,/a/b/c:ro", SINGULARITY_CONTAINER_TYPE) ['/a/b:ro', '/a/b/c:ro'] >>> preprocess_volumes("/a/b:default_ro,/a/b/c:rw", SINGULARITY_CONTAINER_TYPE) ['/a/b', '/a/b/c']
- class galaxy.tool_util.deps.container_classes.HasDockerLikeVolumes[source]¶
Bases:
object
Mixin to share functionality related to Docker volume handling.
Singularity seems to have a fairly compatible syntax for volume handling.
- class galaxy.tool_util.deps.container_classes.DockerContainer(container_id, app_info, tool_info, destination_info, job_info, container_description, container_name=None)[source]¶
Bases:
Container
,HasDockerLikeVolumes
- container_type = 'docker'¶
- property docker_host_props¶
- property connection_configuration¶
galaxy.tool_util.deps.container_volumes module¶
- class galaxy.tool_util.deps.container_volumes.ContainerVolume(path, host_path=None, mode=None)[source]¶
Bases:
object
- valid_modes = frozenset({'ro', 'rw'})¶
- abstract from_str(as_str)[source]¶
Classmethod to convert from this container type’s string representation.
- Parameters
as_str (str) – string representation of volume
- property mode_is_valid¶
- class galaxy.tool_util.deps.container_volumes.DockerVolume(path, host_path=None, mode=None)[source]¶
Bases:
ContainerVolume
galaxy.tool_util.deps.containers module¶
- class galaxy.tool_util.deps.containers.ResolvedContainerDescription(container_resolver, container_description)¶
Bases:
tuple
- property container_description¶
Alias for field number 1
- property container_resolver¶
Alias for field number 0
- class galaxy.tool_util.deps.containers.ContainerFinder(app_info: AppInfo, mulled_resolution_cache: Optional[Cache] = None)[source]¶
Bases:
object
- find_best_container_description(enabled_container_types, tool_info, **kwds)[source]¶
Regardless of destination properties - find best container for tool.
Given container types and container.ToolInfo description of the tool.
- class galaxy.tool_util.deps.containers.ContainerRegistry(app_info: AppInfo, destination_info: Optional[Dict[str, Any]] = None, mulled_resolution_cache: Optional[Cache] = None)[source]¶
Bases:
object
Loop through enabled ContainerResolver plugins and find first match.
- __init__(app_info: AppInfo, destination_info: Optional[Dict[str, Any]] = None, mulled_resolution_cache: Optional[Cache] = None) None [source]¶
galaxy.tool_util.deps.dependencies module¶
- class galaxy.tool_util.deps.dependencies.AppInfo(galaxy_root_dir: Optional[str] = None, default_file_path: Optional[str] = None, tool_data_path: Optional[str] = None, shed_tool_data_path: Optional[str] = None, outputs_to_working_directory: bool = False, container_image_cache_path: Optional[str] = None, library_import_dir: Optional[str] = None, enable_mulled_containers: bool = False, container_resolvers_config_file: Optional[str] = None, container_resolvers_config_dict: Optional[Dict[str, Any]] = None, involucro_path: Optional[str] = None, involucro_auto_init: bool = True, mulled_channels: List[str] = ['conda-forge', 'bioconda'])[source]¶
Bases:
object
- __init__(galaxy_root_dir: Optional[str] = None, default_file_path: Optional[str] = None, tool_data_path: Optional[str] = None, shed_tool_data_path: Optional[str] = None, outputs_to_working_directory: bool = False, container_image_cache_path: Optional[str] = None, library_import_dir: Optional[str] = None, enable_mulled_containers: bool = False, container_resolvers_config_file: Optional[str] = None, container_resolvers_config_dict: Optional[Dict[str, Any]] = None, involucro_path: Optional[str] = None, involucro_auto_init: bool = True, mulled_channels: List[str] = ['conda-forge', 'bioconda']) None [source]¶
- class galaxy.tool_util.deps.dependencies.ToolInfo(container_descriptions: Optional[List[ContainerDescription]] = None, requirements: Optional[Union[ToolRequirements, List[ToolRequirement]]] = None, requires_galaxy_python_environment: bool = False, env_pass_through=None, guest_ports=None, tool_id: Optional[str] = None, tool_version: Optional[str] = None, profile: float = -1)[source]¶
Bases:
object
- __init__(container_descriptions: Optional[List[ContainerDescription]] = None, requirements: Optional[Union[ToolRequirements, List[ToolRequirement]]] = None, requires_galaxy_python_environment: bool = False, env_pass_through=None, guest_ports=None, tool_id: Optional[str] = None, tool_version: Optional[str] = None, profile: float = -1)[source]¶
- class galaxy.tool_util.deps.dependencies.JobInfo(working_directory, tool_directory, job_directory, tmp_directory, home_directory, job_directory_type)[source]¶
Bases:
object
- class galaxy.tool_util.deps.dependencies.DependenciesDescription(requirements=None, installed_tool_dependencies=None)[source]¶
Bases:
object
Capture (in a readily serializable way) context related a tool dependencies - both the tool’s listed requirements and the tool shed related context required to resolve dependencies via the ToolShedPackageDependencyResolver.
This is meant to enable remote resolution of dependencies, by the Pulsar or other potential remote execution mechanisms.
galaxy.tool_util.deps.docker_util module¶
Utilities for building up Docker commands…
…using common defaults and configuration mechanisms.
- galaxy.tool_util.deps.docker_util.build_docker_simple_command(command, docker_cmd='docker', sudo=False, sudo_cmd='sudo', container_name=None, **kwd)[source]¶
- galaxy.tool_util.deps.docker_util.build_docker_run_command(container_command, image, interactive=False, terminal=False, tag=None, volumes=None, volumes_from=None, memory=None, env_directives=None, working_directory=None, name=None, net=None, run_extra_arguments=None, docker_cmd='docker', sudo=False, sudo_cmd='sudo', auto_rm=True, set_user='$UID', host=None, guest_ports=False, container_name=None)[source]¶
- galaxy.tool_util.deps.docker_util.command_list(command, command_args=None, **kwds)[source]¶
Return Docker command as an argv list.
- galaxy.tool_util.deps.docker_util.command_shell(command, command_args=None, **kwds)[source]¶
Return Docker command as a string for a shell or command-list.
- galaxy.tool_util.deps.docker_util.parse_port_text(port_text)[source]¶
>>> slurm_ports = parse_port_text("8888/tcp -> 0.0.0.0:32769") >>> slurm_ports[8888]['host'] '0.0.0.0' >>> ports = parse_port_text("5432/tcp -> :::5432") >>> len(ports) 0 >>> ports_new = parse_port_text("5432/tcp -> [::]:5432") >>> len(ports_new) 0
galaxy.tool_util.deps.dockerfiles module¶
galaxy.tool_util.deps.installable module¶
Abstractions for installing local software managed and required by Galaxy/galaxy-lib.
- class galaxy.tool_util.deps.installable.InstallableContext[source]¶
Bases:
object
Represent a directory/configuration of something that can be installed.
- abstract property installable_description¶
Short description of thing being installed for log statements.
- abstract property parent_path¶
Return parent path of the location the installable will be created within.
galaxy.tool_util.deps.requirements module¶
- class galaxy.tool_util.deps.requirements.ToolRequirement(name=None, type=None, version=None, specs=None)[source]¶
Bases:
object
Represents an external requirement that must be available for the tool to run (for example, a program, package, or library). Requirements can optionally assert a specific version.
- class galaxy.tool_util.deps.requirements.RequirementSpecification(uri, version=None)[source]¶
Bases:
object
Refine a requirement using a URI.
- property specifies_version¶
- property short_name¶
- class galaxy.tool_util.deps.requirements.ToolRequirements(tool_requirements=None)[source]¶
Bases:
object
Represents all requirements (packages, env vars) needed to run a tool.
- static from_list(requirements: Union[List[ToolRequirement], Dict[str, Any]]) ToolRequirements [source]¶
- property resolvable¶
- property packages¶
- class galaxy.tool_util.deps.requirements.ContainerDescription(identifier: Optional[str] = None, type: str = 'docker', resolve_dependencies: bool = False, shell: str = '/bin/sh')[source]¶
Bases:
object
- class galaxy.tool_util.deps.requirements.ResourceRequirement(value_or_expression: Union[int, float, str], resource_type: typing_extensions.Literal[cores_min, cores_max, ram_min, ram_max, tmpdir_min, tmpdir_max, cuda_version_min, cuda_compute_capability, gpu_memory_min, cuda_device_count_min, cuda_device_count_max])[source]¶
Bases:
object
- galaxy.tool_util.deps.requirements.resource_requirements_from_list(requirements) List[ResourceRequirement] [source]¶
- galaxy.tool_util.deps.requirements.parse_requirements_from_lists(software_requirements, containers, resource_requirements) Tuple [source]¶
- galaxy.tool_util.deps.requirements.parse_requirements_from_xml(xml_root, parse_resources=False)[source]¶
Parses requirements, containers and optionally resource requirements from Xml tree.
>>> from galaxy.util import parse_xml_string >>> def load_requirements(contents, parse_resources=False): ... contents_document = '''<tool><requirements>%s</requirements></tool>''' ... root = parse_xml_string(contents_document % contents) ... return parse_requirements_from_xml(root, parse_resources=parse_resources) >>> reqs, containers = load_requirements('''<requirement>bwa</requirement>''') >>> reqs[0].name 'bwa' >>> reqs[0].version is None True >>> reqs[0].type 'package' >>> reqs, containers = load_requirements('''<requirement type="binary" version="1.3.3">cufflinks</requirement>''') >>> reqs[0].name 'cufflinks' >>> reqs[0].version '1.3.3' >>> reqs[0].type 'binary'
galaxy.tool_util.deps.singularity_util module¶
- galaxy.tool_util.deps.singularity_util.build_singularity_run_command(container_command, image, volumes=None, env=None, working_directory=None, singularity_cmd='singularity', run_extra_arguments=None, sudo=False, sudo_cmd='sudo', guest_ports=False, container_name=None, cleanenv=True)[source]¶
galaxy.tool_util.deps.views module¶
- class galaxy.tool_util.deps.views.DependencyResolversView(app)[source]¶
Bases:
object
Provide a RESTfulish/JSONy interface to a galaxy.tool_util.deps.DependencyResolver object. This can be adapted by the Galaxy web framework or other web apps.
- show_dependencies(tool_requirements_d, installed_tool_dependencies=None, **kwd)[source]¶
Resolves dependencies to build a requirements status in the admin panel/API
- uninstall_dependencies(index=None, resolver_type=None, container_type=None, **payload)[source]¶
Attempt to uninstall requirements. Returns 0 if successfull, else None.
- property unused_dependency_paths¶
List dependencies that are not currently installed.
- remove_unused_dependency_paths(envs)[source]¶
Remove dependencies that are not currently used.
Returns a list of all environments that have been successfully removed.
- install_dependency(index=None, **payload)[source]¶
Installs dependency using highest priority resolver that supports dependency installation (Currently only the conda resolver supports this). If index is given, attempt installation directly using the corresponding resolver. Returns True on success, False on failure. payload is dictionary that must container name, version and type, e.g. {‘name’: ‘numpy’, version=’1.9.1’, type=’package’}
- property installable_resolvers¶
List index for all active resolvers that have the ‘install_dependency’ attribute.
- property uninstallable_resolvers¶
List index for all active resolvers that can uninstall dependencies that have been installed through this resolver.
- property tool_ids_by_requirements¶
Dictionary with requirements as keys, and tool_ids as values.
- property toolbox_requirements_status¶