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.resolvers package

The module defines the abstract interface for dealing tool dependency resolution plugins.

class galaxy.tool_util.deps.resolvers.DependencyResolver[source]

Bases: galaxy.util.dictifiable.Dictifiable

Abstract description of a technique for resolving container images for tool execution.

dict_collection_visible_keys = ['resolver_type', 'resolves_simple_dependencies', 'can_uninstall_dependencies', 'read_only']
disabled = False
resolves_simple_dependencies = True
config_options: Dict[str, Any] = {}
read_only = True
abstract resolve(requirement, **kwds)[source]

Given inputs describing dependency in the abstract yield a Dependency object.

The Dependency object describes various attributes (script, bin, version) used to build scripts with the dependency availble. Here script is the env.sh file to source before running a job, if that is not found the bin directory will be appended to the path (if it is not None). Finally, version is the resolved tool dependency version (which may differ from requested version for instance if the request version is ‘default’.)

install_dependency(name, version, type, **kwds)[source]
property can_uninstall_dependencies
class galaxy.tool_util.deps.resolvers.MultipleDependencyResolver[source]

Bases: object

Variant of DependencyResolver that can optionally resolve multiple dependencies together.

abstract resolve_all(requirements, **kwds)[source]

Given multiple requirements yields a list of Dependency objects if and only if they may all be resolved together.

Unsuccessfull attempts should return an empty list.

Parameters
  • requirements – list of tool requirements

  • type – [ToolRequirement] or ToolRequirements

Returns

list of resolved dependencies

Return type

[Dependency]

class galaxy.tool_util.deps.resolvers.ListableDependencyResolver[source]

Bases: object

Mix this into a DependencyResolver and implement to indicate the dependency resolver can iterate over its dependencies and generate requirements.

abstract list_dependencies()[source]

List the “simple” requirements that may be resolved “exact”-ly by this dependency resolver.

class galaxy.tool_util.deps.resolvers.MappableDependencyResolver[source]

Bases: object

Mix this into a DependencyResolver to allow mapping files.

Mapping files allow adapting generic requirements to specific local implementations.

class galaxy.tool_util.deps.resolvers.RequirementMapping(from_name, from_version, to_name, to_version)[source]

Bases: object

__init__(from_name, from_version, to_name, to_version)[source]

Initialize self. See help(type(self)) for accurate signature.

matches_requirement(requirement)[source]

Check if supplied ToolRequirement matches this mapping description.

For it to match - the names must match. Additionally if the requirement is created with a version or with unversioned being set to True additional checks are needed. If a version is specified, it must match the supplied version exactly. If unversioned is True, then the supplied requirement must be unversioned (i.e. its version must be set to None).

apply(requirement)[source]
static from_dict(raw_mapping)[source]
class galaxy.tool_util.deps.resolvers.SpecificationAwareDependencyResolver[source]

Bases: object

Mix this into a DependencyResolver to implement URI specification matching.

Allows adapting generic requirements to more specific URIs - to tailor name or version to specified resolution system.

class galaxy.tool_util.deps.resolvers.SpecificationPatternDependencyResolver[source]

Bases: galaxy.tool_util.deps.resolvers.SpecificationAwareDependencyResolver

Implement the SpecificationAwareDependencyResolver with a regex pattern.

class galaxy.tool_util.deps.resolvers.Dependency[source]

Bases: galaxy.util.dictifiable.Dictifiable

dict_collection_visible_keys = ['dependency_type', 'exact', 'name', 'version', 'cacheable']
cacheable = False
abstract shell_commands()[source]

Return shell commands to enable this dependency.

abstract property exact

Return true if version information wasn’t discarded to resolve the dependency.

property resolver_msg

Return a message describing this dependency

class galaxy.tool_util.deps.resolvers.ContainerDependency(container_description, name=None, version=None, container_resolver=None)[source]

Bases: galaxy.tool_util.deps.resolvers.Dependency

dict_collection_visible_keys = ['dependency_type', 'exact', 'name', 'version', 'cacheable', 'environment_path', 'container_description', 'container_resolver']
__init__(container_description, name=None, version=None, container_resolver=None)[source]

Initialize self. See help(type(self)) for accurate signature.

property name
property version
property exact

Return true if version information wasn’t discarded to resolve the dependency.

property shell_commands

Return shell commands to enable this dependency.

class galaxy.tool_util.deps.resolvers.NullDependency(version=None, name=None)[source]

Bases: galaxy.tool_util.deps.resolvers.Dependency

dependency_type = None
exact = True
__init__(version=None, name=None)[source]

Initialize self. See help(type(self)) for accurate signature.

property resolver_msg

Return a message describing this dependency

shell_commands()[source]

Return shell commands to enable this dependency.

exception galaxy.tool_util.deps.resolvers.DependencyException[source]

Bases: Exception

Submodules

galaxy.tool_util.deps.resolvers.brewed_tool_shed_packages module

This dependency resolver resolves tool shed dependencies (those defined tool_dependencies.xml) installed using Platform Homebrew and converted via shed2tap (e.g. https://github.com/jmchilton/homebrew-toolshed).

class galaxy.tool_util.deps.resolvers.brewed_tool_shed_packages.HomebrewToolShedDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.DependencyResolver, galaxy.tool_util.deps.resolvers.resolver_mixins.UsesHomebrewMixin, galaxy.tool_util.deps.resolvers.resolver_mixins.UsesToolDependencyDirMixin, galaxy.tool_util.deps.resolvers.resolver_mixins.UsesInstalledRepositoriesMixin

resolver_type = 'tool_shed_tap'
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

resolve(requirement, **kwds)[source]

Given inputs describing dependency in the abstract yield a Dependency object.

The Dependency object describes various attributes (script, bin, version) used to build scripts with the dependency availble. Here script is the env.sh file to source before running a job, if that is not found the bin directory will be appended to the path (if it is not None). Finally, version is the resolved tool dependency version (which may differ from requested version for instance if the request version is ‘default’.)

galaxy.tool_util.deps.resolvers.conda module

This is still an experimental module and there will almost certainly be backward incompatible changes coming.

class galaxy.tool_util.deps.resolvers.conda.CondaDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.DependencyResolver, galaxy.tool_util.deps.resolvers.MultipleDependencyResolver, galaxy.tool_util.deps.resolvers.ListableDependencyResolver, galaxy.tool_util.deps.resolvers.SpecificationPatternDependencyResolver, galaxy.tool_util.deps.resolvers.MappableDependencyResolver

dict_collection_visible_keys = ['resolver_type', 'resolves_simple_dependencies', 'can_uninstall_dependencies', 'read_only', 'prefix', 'versionless', 'ensure_channels', 'auto_install', 'auto_init', 'use_local']
resolver_type = 'conda'
config_options: Dict[str, Any] = {'auto_init': True, 'auto_install': False, 'copy_dependencies': False, 'debug': None, 'ensure_channels': 'conda-forge,bioconda,defaults', 'exec': None, 'prefix': None, 'use_local': False}
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

clean(**kwds)[source]
uninstall(requirements)[source]

Uninstall requirements installed by install_all or multiple install statements.

uninstall_environments(environments)[source]
install_all(conda_targets)[source]
resolve_all(requirements, **kwds)[source]

Some combinations of tool requirements need to be resolved all at once, so that Conda can select a compatible combination of dependencies. This method returns a list of MergedCondaDependency instances (one for each requirement) if all requirements have been successfully resolved, or an empty list if any of the requirements could not be resolved.

Parameters specific to this resolver are:

preserve_python_environment: Boolean, controls whether the python environment should be maintained during job creation for tools

that rely on galaxy being importable.

install: Controls if requirements should be installed. If install is True and the requirements are not installed

an attempt is made to install the requirements. If install is None requirements will only be installed if conda_auto_install has been activated and the requirements are not yet installed. If install is False will not install requirements.

merged_environment_name(conda_targets)[source]
resolve(requirement, **kwds)[source]

Given inputs describing dependency in the abstract yield a Dependency object.

The Dependency object describes various attributes (script, bin, version) used to build scripts with the dependency availble. Here script is the env.sh file to source before running a job, if that is not found the bin directory will be appended to the path (if it is not None). Finally, version is the resolved tool dependency version (which may differ from requested version for instance if the request version is ‘default’.)

unused_dependency_paths(toolbox_requirements_status)[source]

Identify all local environments that are not needed to build requirements_status.

We try to resolve the requirements, and we note every environment_path that has been taken.

list_dependencies()[source]

List the “simple” requirements that may be resolved “exact”-ly by this dependency resolver.

property prefix

galaxy.tool_util.deps.resolvers.galaxy_packages module

class galaxy.tool_util.deps.resolvers.galaxy_packages.GalaxyPackageDependency(script, path, name, type, version, exact=True, dependency_resolver=None)[source]

Bases: galaxy.tool_util.deps.resolvers.Dependency

dict_collection_visible_keys = ['dependency_type', 'exact', 'name', 'version', 'cacheable', 'script', 'path', 'version', 'name', 'dependency_resolver']
dependency_type = 'galaxy_package'
__init__(script, path, name, type, version, exact=True, dependency_resolver=None)[source]

Initialize self. See help(type(self)) for accurate signature.

property exact

Return true if version information wasn’t discarded to resolve the dependency.

shell_commands()[source]

Return shell commands to enable this dependency.

class galaxy.tool_util.deps.resolvers.galaxy_packages.GalaxyPackageDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.galaxy_packages.BaseGalaxyPackageDependencyResolver, galaxy.tool_util.deps.resolvers.ListableDependencyResolver, galaxy.tool_util.deps.resolvers.MappableDependencyResolver

resolver_type = 'galaxy_packages'
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

resolve(requirement, **kwds)[source]

Attempt to find a dependency named name at version version. If version is None, return the “default” version as determined using a symbolic link (if found). Returns a triple of: env_script, base_path, real_version

list_dependencies()[source]

List the “simple” requirements that may be resolved “exact”-ly by this dependency resolver.

class galaxy.tool_util.deps.resolvers.galaxy_packages.ToolShedDependency(script, path, name, type, version, exact=True, dependency_resolver=None)[source]

Bases: galaxy.tool_util.deps.resolvers.galaxy_packages.GalaxyPackageDependency

dependency_type = 'tool_shed_package'

galaxy.tool_util.deps.resolvers.homebrew module

This file implements a brew resolver for Galaxy requirements. In order for Galaxy to pick up on recursively defined and versioned brew dependencies recipes should be installed using the experimental brew-vinstall external command.

More information here:

https://github.com/jmchilton/brew-tests https://github.com/Homebrew/homebrew-science/issues/1191

This is still an experimental module and there will almost certainly be backward incompatible changes coming.

class galaxy.tool_util.deps.resolvers.homebrew.HomebrewDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.DependencyResolver, galaxy.tool_util.deps.resolvers.resolver_mixins.UsesHomebrewMixin

resolver_type = 'homebrew'
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

resolve(requirement, **kwds)[source]

Given inputs describing dependency in the abstract yield a Dependency object.

The Dependency object describes various attributes (script, bin, version) used to build scripts with the dependency availble. Here script is the env.sh file to source before running a job, if that is not found the bin directory will be appended to the path (if it is not None). Finally, version is the resolved tool dependency version (which may differ from requested version for instance if the request version is ‘default’.)

galaxy.tool_util.deps.resolvers.lmod module

This is a prototype dependency resolver to be able to use the “LMOD environment modules system” from TACC to solve package requirements

LMOD official website: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod

LMOD @ Github: https://github.com/TACC/Lmod

class galaxy.tool_util.deps.resolvers.lmod.LmodDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.DependencyResolver, galaxy.tool_util.deps.resolvers.MappableDependencyResolver

Dependency resolver based on the LMOD environment modules system

dict_collection_visible_keys = ['resolver_type', 'resolves_simple_dependencies', 'can_uninstall_dependencies', 'read_only', 'base_path', 'modulepath']
resolver_type = 'lmod'
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

resolve(requirement, **kwds)[source]

Given inputs describing dependency in the abstract yield a Dependency object.

The Dependency object describes various attributes (script, bin, version) used to build scripts with the dependency availble. Here script is the env.sh file to source before running a job, if that is not found the bin directory will be appended to the path (if it is not None). Finally, version is the resolved tool dependency version (which may differ from requested version for instance if the request version is ‘default’.)

galaxy.tool_util.deps.resolvers.modules module

This file contains the outline of an implementation to load environment modules (http://modules.sourceforge.net/).

This is a community contributed feature and the core Galaxy team does utilize it, hence support for it will be minimal. The Galaxy team eagerly welcomes community contribution and maintenance however.

class galaxy.tool_util.deps.resolvers.modules.ModuleDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.DependencyResolver, galaxy.tool_util.deps.resolvers.MappableDependencyResolver

dict_collection_visible_keys = ['resolver_type', 'resolves_simple_dependencies', 'can_uninstall_dependencies', 'read_only', 'base_path', 'modulepath', 'modulecmd', 'prefetch', 'default_indicator', 'find_by']
resolver_type = 'modules'
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

resolve(requirement, **kwds)[source]

Given inputs describing dependency in the abstract yield a Dependency object.

The Dependency object describes various attributes (script, bin, version) used to build scripts with the dependency availble. Here script is the env.sh file to source before running a job, if that is not found the bin directory will be appended to the path (if it is not None). Finally, version is the resolved tool dependency version (which may differ from requested version for instance if the request version is ‘default’.)

galaxy.tool_util.deps.resolvers.resolver_mixins module

class galaxy.tool_util.deps.resolvers.resolver_mixins.UsesHomebrewMixin[source]

Bases: object

class galaxy.tool_util.deps.resolvers.resolver_mixins.UsesToolDependencyDirMixin[source]

Bases: object

class galaxy.tool_util.deps.resolvers.resolver_mixins.UsesInstalledRepositoriesMixin[source]

Bases: object

class galaxy.tool_util.deps.resolvers.resolver_mixins.HomebrewDependency(commands, exact=True)[source]

Bases: galaxy.tool_util.deps.resolvers.Dependency

__init__(commands, exact=True)[source]

Initialize self. See help(type(self)) for accurate signature.

property exact

Return true if version information wasn’t discarded to resolve the dependency.

shell_commands()[source]

Return shell commands to enable this dependency.

galaxy.tool_util.deps.resolvers.tool_shed_packages module

class galaxy.tool_util.deps.resolvers.tool_shed_packages.ToolShedPackageDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.galaxy_packages.BaseGalaxyPackageDependencyResolver, galaxy.tool_util.deps.resolvers.resolver_mixins.UsesInstalledRepositoriesMixin

resolver_type = 'tool_shed_packages'
dependency_type

alias of galaxy.tool_util.deps.resolvers.galaxy_packages.ToolShedDependency

resolves_simple_dependencies = False
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.

galaxy.tool_util.deps.resolvers.unlinked_tool_shed_packages module

Backup resolvers for when dependencies can not be loaded from the database. Mainly suited for testing stage.

Ideally all dependencies will be stored in the database when a tool is added from a Tool Shed.

That should remain the preferred way of locating dependencies.

In cases where that is not possible for example during testing this resolver can act as a backup.

This resolver looks not just for manually added dependencies but also ones added from a Tool Shed.

This tool is still under development so the default behaviour could change. It has been tested when placed in the same directory as galaxy_packages.py

At the time of writing July 3 2015 this resolver has to be plugged in. See bottom for instructions on how to add this resolver.

class galaxy.tool_util.deps.resolvers.unlinked_tool_shed_packages.UnlinkedToolShedPackageDependencyResolver(dependency_manager, **kwds)[source]

Bases: galaxy.tool_util.deps.resolvers.galaxy_packages.BaseGalaxyPackageDependencyResolver

dict_collection_visible_keys = ['resolver_type', 'resolves_simple_dependencies', 'can_uninstall_dependencies', 'read_only', 'base_path', 'versionless', 'preferred_owners', 'select_by_owner']
resolver_type = 'unlinked_tool_shed_packages'
__init__(dependency_manager, **kwds)[source]

Initialize self. See help(type(self)) for accurate signature.