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.tools.deps package

Dependency management for tools.

galaxy.tools.deps.build_dependency_manager(config)[source]
class galaxy.tools.deps.NullDependencyManager[source]

Bases: object

dependency_resolvers = []
uses_tool_shed_dependencies()[source]
dependency_shell_commands(requirements, **kwds)[source]
find_dep(name, version=None, type='package', **kwds)[source]
class galaxy.tools.deps.DependencyManager(default_base_path, conf_file=None, app_config={})[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.

__init__(default_base_path, conf_file=None, app_config={})[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.

get_resolver_option(resolver, key, explicit_resolver_options={})[source]

Look in resolver-specific settings for option and then fallback to global settings.

get_app_option(key, default=None)[source]
dependency_shell_commands(requirements, **kwds)[source]
requirements_to_dependencies(requirements, **kwds)[source]

Takes a list of requirements and returns a dictionary with requirements as key and dependencies as value caching these on the tool instance if supplied.

uses_tool_shed_dependencies()[source]
find_dep(name, version=None, type='package', **kwds)[source]
class galaxy.tools.deps.CachedDependencyManager(default_base_path, conf_file=None, app_config={}, tool_dependency_cache_dir=None)[source]

Bases: galaxy.tools.deps.DependencyManager

__init__(default_base_path, conf_file=None, app_config={}, tool_dependency_cache_dir=None)[source]
build_cache(requirements, **kwds)[source]
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.

hash_dependencies(resolved_dependencies)[source]

Return hash for dependencies

get_hashed_dependencies_path(resolved_dependencies)[source]

Returns the path to the hashed dependencies directory (but does not evaluate whether the path exists).

Parameters:resolved_dependencies (list) – list of resolved dependencies
Returns:path
Return type:str

Submodules

galaxy.tools.deps.brew_exts module

class galaxy.tools.deps.brew_exts.BrewContext(args=None)[source]

Bases: object

__init__(args=None)[source]
class galaxy.tools.deps.brew_exts.RecipeContext(recipe, version, brew_context=None)[source]

Bases: object

static from_args(args, brew_context=None)[source]
__init__(recipe, version, brew_context=None)[source]
cellar_path
tap_path
galaxy.tools.deps.brew_exts.main()[source]
exception galaxy.tools.deps.brew_exts.CommandLineException(command, stdout, stderr)[source]

Bases: exceptions.Exception

__init__(command, stdout, stderr)[source]
galaxy.tools.deps.brew_exts.versioned_install(recipe_context, package=None, version=None, installed_deps=[])[source]
galaxy.tools.deps.brew_exts.commit_for_version(recipe_context, package, version)[source]
galaxy.tools.deps.brew_exts.print_versioned_deps(recipe_context, recipe, version)[source]
galaxy.tools.deps.brew_exts.load_versioned_deps(cellar_path, relaxed=None)[source]
galaxy.tools.deps.brew_exts.unversioned_install(package)[source]
galaxy.tools.deps.brew_exts.brew_execute(args, env=None)[source]
galaxy.tools.deps.brew_exts.build_env_statements_from_recipe_context(recipe_context, **kwds)[source]
galaxy.tools.deps.brew_exts.build_env_statements(cellar_root, cellar_path, relaxed=None, custom_only=False)[source]
galaxy.tools.deps.brew_exts.build_env_actions(deps, cellar_root, cellar_path, relaxed=None, custom_only=False)[source]
class galaxy.tools.deps.brew_exts.EnvAction(keg_root, action_description)[source]

Bases: object

__init__(keg_root, action_description)[source]
static build_env(env_actions)[source]
modify_environ(environ)[source]
to_statements()[source]
galaxy.tools.deps.brew_exts.brew_head_at_version(*args, **kwds)[source]
galaxy.tools.deps.brew_exts.brew_head_at_commit(*args, **kwds)[source]
galaxy.tools.deps.brew_exts.git_execute(args)[source]
galaxy.tools.deps.brew_exts.execute(cmds, env=None)[source]
galaxy.tools.deps.brew_exts.brew_deps(package)[source]
galaxy.tools.deps.brew_exts.brew_info(recipe)[source]
galaxy.tools.deps.brew_exts.extended_brew_info(recipe)[source]
galaxy.tools.deps.brew_exts.brew_versions_info(package, tap_path)[source]
galaxy.tools.deps.brew_exts.recipe_cellar_path(cellar_path, recipe, version)[source]
galaxy.tools.deps.brew_exts.ensure_brew_on_path(args)[source]
galaxy.tools.deps.brew_exts.which(file)[source]

galaxy.tools.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.

class galaxy.tools.deps.brew_util.HomebrewRecipe(recipe, version, tap)[source]

Bases: object

__init__(recipe, version, tap)[source]
galaxy.tools.deps.brew_util.requirements_to_recipes(requirements)[source]
galaxy.tools.deps.brew_util.requirement_to_recipe(requirement)[source]
galaxy.tools.deps.brew_util.requirements_to_recipe_contexts(requirements, brew_context)[source]

galaxy.tools.deps.commands module

Generic I/O and shell processing code used by Galaxy tool dependencies.

galaxy.tools.deps.commands.redirecting_io(sys=<module 'sys' (built-in)>)[source]

Predicate to determine if we are redicting I/O in process.

galaxy.tools.deps.commands.redirect_aware_commmunicate(p, sys=<module 'sys' (built-in)>)[source]

Variant of process.communicate that works with in process I/O redirection.

galaxy.tools.deps.commands.shell(cmds, env=None, **kwds)[source]

Run shell commands with shell_process and wait.

galaxy.tools.deps.commands.shell_process(cmds, env=None, **kwds)[source]

A high-level method wrapping subprocess.Popen.

Handles details such as environment extension and in process I/O redirection.

galaxy.tools.deps.commands.execute(cmds)[source]

Execute commands and throw an exception on a non-zero exit.

Return the standard output if the commands are successful

galaxy.tools.deps.commands.argv_to_str(command_argv, quote=True)[source]

Convert an argv command list to a string for shell subprocess.

If None appears in the command list it is simply excluded.

Arguments are quoted with shlex_quote. That said, this method is not meant to be used in security critical paths of code and should not be used to sanitize code.

galaxy.tools.deps.commands.download_command(url, to='-', quote_url=False)[source]

Build a command line to download a URL.

By default the URL will be downloaded to standard output but a specific file can be specified with the to argument.

exception galaxy.tools.deps.commands.CommandLineException(command, stdout, stderr, returncode)[source]

Bases: exceptions.Exception

An exception indicating a non-zero command-line exit.

__init__(command, stdout, stderr, returncode)[source]

Construct a CommandLineException from command and standard I/O.

galaxy.tools.deps.commands.which(file)[source]

galaxy.tools.deps.containers module

class galaxy.tools.deps.containers.ContainerFinder(app_info)[source]

Bases: object

__init__(app_info)[source]
find_best_container_description(enabled_container_types, tool_info)[source]

Regardless of destination properties - find best container for tool.

Given container types and container.ToolInfo description of the tool.

find_container(tool_info, destination_info, job_info)[source]
class galaxy.tools.deps.containers.NullContainerFinder[source]

Bases: object

find_container(tool_info, destination_info, job_info)[source]
class galaxy.tools.deps.containers.ContainerRegistry(app_info)[source]

Bases: object

Loop through enabled ContainerResolver plugins and find first match.

__init__(app_info)[source]
find_best_container_description(enabled_container_types, tool_info)[source]

Yield best container description of supplied types matching tool info.

class galaxy.tools.deps.containers.AppInfo(galaxy_root_dir=None, default_file_path=None, outputs_to_working_directory=False, container_image_cache_path=None, library_import_dir=None, enable_beta_mulled_containers=False, containers_resolvers_config_file=None, involucro_path=None, involucro_auto_init=True)[source]

Bases: object

__init__(galaxy_root_dir=None, default_file_path=None, outputs_to_working_directory=False, container_image_cache_path=None, library_import_dir=None, enable_beta_mulled_containers=False, containers_resolvers_config_file=None, involucro_path=None, involucro_auto_init=True)[source]
class galaxy.tools.deps.containers.ToolInfo(container_descriptions=[], requirements=[], requires_galaxy_python_environment=False)[source]

Bases: object

__init__(container_descriptions=[], requirements=[], requires_galaxy_python_environment=False)[source]
class galaxy.tools.deps.containers.JobInfo(working_directory, tool_directory, job_directory, job_directory_type)[source]

Bases: object

__init__(working_directory, tool_directory, job_directory, job_directory_type)[source]
class galaxy.tools.deps.containers.Container(container_id, app_info, tool_info, destination_info, job_info, container_description)[source]

Bases: object

__init__(container_id, app_info, tool_info, destination_info, job_info, container_description)[source]
resolve_dependencies
shell
containerize_command(command)[source]

Use destination supplied container configuration parameters, container_id, and command to build a new command that runs input command in container.

class galaxy.tools.deps.containers.DockerContainer(container_id, app_info, tool_info, destination_info, job_info, container_description)[source]

Bases: galaxy.tools.deps.containers.Container

containerize_command(command)[source]
galaxy.tools.deps.containers.docker_cache_path(cache_directory, container_id)[source]
class galaxy.tools.deps.containers.NullContainer[source]

Bases: object

__init__()[source]

galaxy.tools.deps.dependencies module

class galaxy.tools.deps.dependencies.DependenciesDescription(requirements=[], installed_tool_dependencies=[])[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.

__init__(requirements=[], installed_tool_dependencies=[])[source]
to_dict()[source]
static from_dict(as_dict)[source]

galaxy.tools.deps.docker_util module

Utilities for building up Docker commands…

…using common defaults and configuration mechanisms.

class galaxy.tools.deps.docker_util.DockerVolume(path, to_path=None, how='rw')[source]

Bases: object

__init__(path, to_path=None, how='rw')[source]
static volumes_from_str(volumes_as_str)[source]
static volume_from_str(as_str)[source]
galaxy.tools.deps.docker_util.kill_command(container, signal=None, **kwds)[source]
galaxy.tools.deps.docker_util.logs_command(container, **kwds)[source]
galaxy.tools.deps.docker_util.build_command(image, docker_build_path, **kwds)[source]
galaxy.tools.deps.docker_util.build_save_image_command(image, destination, **kwds)[source]
galaxy.tools.deps.docker_util.build_pull_command(tag, **kwds)[source]
galaxy.tools.deps.docker_util.build_docker_cache_command(image, **kwds)[source]
galaxy.tools.deps.docker_util.build_docker_images_command(truncate=True, **kwds)[source]
galaxy.tools.deps.docker_util.build_docker_load_command(**kwds)[source]
galaxy.tools.deps.docker_util.build_docker_run_command(container_command, image, interactive=False, terminal=False, tag=None, volumes=[], volumes_from=None, memory=None, env_directives=[], working_directory=None, name=None, net=None, run_extra_arguments=None, docker_cmd='docker', sudo=True, sudo_cmd='sudo', auto_rm=True, set_user='$UID', host=None)[source]
galaxy.tools.deps.docker_util.command_list(command, command_args=[], **kwds)[source]

Return Docker command as an argv list.

galaxy.tools.deps.docker_util.command_shell(command, command_args=[], **kwds)[source]

Return Docker command as a string for a shell.

galaxy.tools.deps.dockerfiles module

galaxy.tools.deps.dockerfiles.docker_host_args(**kwds)[source]
galaxy.tools.deps.dockerfiles.dockerfile_build(path, dockerfile=None, error=<bound method Logger.error of <logging.Logger object>>, **kwds)[source]

galaxy.tools.deps.requirements module

class galaxy.tools.deps.requirements.ToolRequirement(name=None, type=None, version=None, specs=[])[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.

__init__(name=None, type=None, version=None, specs=[])[source]
to_dict()[source]
copy()[source]
static from_dict(dict)[source]
class galaxy.tools.deps.requirements.RequirementSpecification(uri, version=None)[source]

Bases: object

Refine a requirement using a URI.

__init__(uri, version=None)[source]
specifies_version
short_name
to_dict()[source]
static from_dict(dict)[source]
class galaxy.tools.deps.requirements.ToolRequirements(tool_requirements=None)[source]

Bases: object

Represents all requirements (packages, env vars) needed to run a tool.

__init__(tool_requirements=None)[source]
static from_list(requirements)[source]
resolvable
packages
to_list()[source]
append(requirement)[source]
exception galaxy.tools.deps.requirements.ToolRequirementsException[source]

Bases: exceptions.Exception

class galaxy.tools.deps.requirements.ContainerDescription(identifier=None, type='docker', resolve_dependencies=False, shell='/bin/sh')[source]

Bases: object

__init__(identifier=None, type='docker', resolve_dependencies=False, shell='/bin/sh')[source]
to_dict()[source]
static from_dict(dict)[source]
galaxy.tools.deps.requirements.parse_requirements_from_dict(root_dict)[source]
galaxy.tools.deps.requirements.parse_requirements_from_xml(xml_root)[source]
>>> from xml.etree import ElementTree
>>> def load_requirements( contents ):
...     contents_document = '''<tool><requirements>%s</requirements></tool>'''
...     root = ElementTree.fromstring( contents_document % contents )
...     return parse_requirements_from_xml( root )
>>> 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.tools.deps.requirements.container_from_element(container_elem)[source]