Permalink
Please sign in to comment.
Browse files
First crack at containers documentation and related usability improve…
…ments. - Implement ``planemo lint --biocontainer`` to mirror ``planemo lint --conda_requirements``. Just checks that a tool is ready to go with best practice namespaces for BioContainers tools. - Implement test case for new linting flag. - Add new section of documentation to advanced tool topics for containers. Work through examples of both an existing working container (seqtk) and one that must be built on the fly. Demonstrate ``planemo mull``. - Hack around a bug in Conda 4.2 that makes it so ``planemo mull`` doesn't work out of the box on Mac OS X. - Add more options and more documentation to the ``planemo mull`` command.
- Loading branch information...
Showing
with
478 additions
and 13 deletions.
- +2 −0 docs/_writing_dependencies_conda.rst
- +319 −0 docs/_writing_dependencies_docker.rst
- +1 −1 docs/conf.py
- +8 −0 docs/planemo.commands.rst
- +8 −0 docs/planemo.linters.rst
- +1 −0 docs/writing_advanced.rst
- +1 −0 planemo/commands/cmd_docker_shell.py
- +6 −0 planemo/commands/cmd_lint.py
- +4 −1 planemo/commands/cmd_mull.py
- +4 −0 planemo/lint.py
- +60 −0 planemo/linters/biocontainer_registered.py
- +16 −3 planemo/mulled.py
- +41 −0 planemo/options.py
- +4 −4 project_templates/conda_testing/bwa_and_samtools.xml
- +1 −1 requirements.txt
- +2 −3 tests/test_lint.py
@@ -0,0 +1,60 @@ | |||
"""Ensure best-practice biocontainer registered for this tool.""" | |||
|
|||
from galaxy.tools.deps.mulled.util import ( | |||
build_target, | |||
image_name, | |||
mulled_tags_for, | |||
split_tag, | |||
) | |||
|
|||
from planemo.conda import tool_source_conda_targets | |||
|
|||
MESSAGE_WARN_NO_REQUIREMENTS = "No valid package requirement tags found to infer BioContainer from." | |||
MESSAGE_WARN_NO_CONTAINER = "Failed to find a BioContainer registered for these requirements." | |||
MESSAGE_INFO_FOUND_BIOCONTAINER = "BioContainer best-practice container found [%s]." | |||
|
|||
|
|||
def lint_biocontainer_registered(tool_source, lint_ctx): | |||
conda_targets = tool_source_conda_targets(tool_source) | |||
if not conda_targets: | |||
lint_ctx.warn(MESSAGE_WARN_NO_REQUIREMENTS) | |||
return | |||
|
|||
mulled_targets = map(lambda c: build_target(c.package, c.version), conda_targets) | |||
name = mulled_container_name("biocontainers", mulled_targets) | |||
if name: | |||
lint_ctx.info(MESSAGE_INFO_FOUND_BIOCONTAINER % name) | |||
else: | |||
lint_ctx.warn(MESSAGE_WARN_NO_CONTAINER) | |||
|
|||
|
|||
# TODO: Refactor following method into mulled util and then refactor same code out of mulled | |||
# container resolver. | |||
def mulled_container_name(namespace, targets): | |||
name = None | |||
|
|||
if len(targets) == 1: | |||
target = targets[0] | |||
target_version = target.version | |||
tags = mulled_tags_for(namespace, target.package_name) | |||
|
|||
if not tags: | |||
return None | |||
|
|||
if target_version: | |||
for tag in tags: | |||
version, build = split_tag(tag) | |||
if version == target_version: | |||
name = "%s:%s--%s" % (target.package_name, version, build) | |||
break | |||
else: | |||
version, build = split_tag(tags[0]) | |||
name = "%s:%s--%s" % (target.package_name, version, build) | |||
else: | |||
base_image_name = image_name(targets) | |||
tags = mulled_tags_for(namespace, base_image_name) | |||
if tags: | |||
name = "%s:%s" % (base_image_name, tags[0]) | |||
|
|||
if name: | |||
return "quay.io/%s/%s" % (namespace, name) |
0 comments on commit
0a1abfe