How to use the planemo.cli.command_function function in planemo

To help you get started, we’ve selected a few planemo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github galaxyproject / planemo / planemo / commands / cmd_config_init.py View on Github external
@command_function
def cli(ctx, path, template=None, **kwds):
    """Help initialize global configuration (in home directory) for Planemo.
    """
    # TODO: prompt for values someday.
    config_path = config.global_config_path()
    if os.path.exists(config_path):
        warn("File %s already exists, exiting." % config_path)
        sys.exit(1)
    with open(config_path, "w") as f:
        f.write(CONFIG_TEMPLATE)
        info(SUCCESS_MESSAGE % config_path)
github galaxyproject / planemo / planemo / commands / cmd_conda_lint.py View on Github external
@command_function
def cli(ctx, paths, **kwds):
    """Check conda recipe for common issues.

    Built in large part on the work from the BSD licensed anaconda-verify
    project. For more information on anacoda-verify see:
    https://github.com/ContinuumIO/anaconda-verify.
    """
    exit_code = conda_lint.lint_recipes_on_paths(ctx, paths, **kwds)
    ctx.exit(exit_code)
github galaxyproject / planemo / planemo / commands / cmd_conda_search.py View on Github external
@command_function
def cli(ctx, term, **kwds):
    """Perform conda search with Planemo's conda.

    Implicitly adds channels Planemo is configured with.
    """
    conda_context = build_conda_context(ctx, handle_auto_init=True, **kwds)
    conda_context.exec_command("search", [term])
github galaxyproject / planemo / planemo / commands / cmd_project_init.py View on Github external
@command_function
def cli(ctx, path, template=None, **kwds):
    """(Experimental) Initialize a new tool project.

    This is only a proof-of-concept demo right now.
    """
    if template is None:
        warn("Creating empty project, this function doesn't do much yet.")
    if not os.path.exists(path):
        os.makedirs(path)
    if template is None:
        return

    tempdir = tempfile.mkdtemp()
    try:
        untar_args = UNTAR_ARGS % (tempdir)
        untar_to(DOWNLOAD_URL, tempdir, untar_args)
github galaxyproject / planemo / planemo / commands / cmd_mull.py View on Github external
@command_function
def cli(ctx, paths, **kwds):
    """Build containers for specified tools.

    Supplied tools will be inspected for referenced requirement packages. For
    each combination of requirements a "mulled" container will be built. Galaxy
    can automatically discover this container and subsequently use it to run
    or test the tool.

    For this to work, the tool's requirements will need to be present in a known
    Conda channel such as bioconda (https://github.com/bioconda/bioconda-recipes).
    This can be verified by running ``planemo lint --conda_requirements`` on the
    target tool(s).
    """
    for mulled_targets in collect_mulled_target_lists(ctx, paths, recursive=kwds["recursive"]):
        mull_target_kwds = build_mull_target_kwds(ctx, **kwds)
        command = kwds["mulled_command"]
github galaxyproject / planemo / planemo / commands / cmd_brew_env.py View on Github external
@command_function
def cli(ctx, path, brew=None, skip_install=False, shell=None):
    """List commands to inject brew dependencies.

    Display commands used to modify environment to inject tool's brew
    dependencies.

    \b
        % . <(planemo brew_env bowtie2.xml)
        % which bowtie2
        /home/john/.linuxbrew/Cellar/bowtie2/2.1.0/bin/bowtie2

    By default this will attempt to attempt to install these recipes as needed.
    This automatic installation can be skipped with the ``--skip_install``
    flag.

    Intead of injecting the enviornment into your current shell using the above
github galaxyproject / planemo / planemo / commands / cmd_conda_env.py View on Github external
@command_function
def cli(ctx, path, **kwds):
    """Activate a conda environment for tool.

    Source the output of this command to activate a conda environment for this
    tool.

    \b
        $ . <(planemo conda_env seqtk_seq.xml)
        Deactivate environment with conda_env_deactivate
        (seqtk_seq_v6) $ which seqtk
        /home/planemo/miniconda2/envs/jobdepsDkzcjjfecc6d406196737781ff4456ec60975c137e04884e4f4b05dc68192f7cec4656/bin/seqtk
        (seqtk_seq_v6) $ conda_env_deactivate
        $

    """
    conda_context = build_conda_context(ctx, use_planemo_shell_exec=False, **kwds)
github galaxyproject / planemo / planemo / commands / cmd_pull_request.py View on Github external
@command_function
def cli(ctx, path, message=None, **kwds):
    """Short-cut to quickly create a pull request for a relevant Github repo.

    For instance, the following will clone, fork, and branch the tools-iuc
    repository to allow a subsequent pull request to fix a problem with bwa.

    \b
        $ planemo clone --branch bwa-fix tools-iuc
        $ cd tools-iuc
        $ # Make changes.
        $ git add -p # Add desired changes.
        $ git commit -m "Fix bwa problem."
        $ planemo pull_request -m "Fix bwa problem."

    These changes do require that a github username and password are
    specified in ~/.planemo.yml.
github galaxyproject / planemo / planemo / commands / cmd_shed_update.py View on Github external
@command_function
def cli(ctx, paths, **kwds):
    """Update Tool Shed repository.

    By default this command will update both repository metadata
    from ``.shed.yml`` and upload new contents from the repository
    directory.

    \b
        % planemo shed_update

    This will update the main tool shed with the repository defined
    by a ``.shed.yml`` file in the current working directory. Both
    the location of the ``.shed.yml`` and the tool shed to upload to
    can be easily configured. For instance, the following command can
    be used if ``.shed.yml`` if contained in ``path/to/repo`` and the
    desire is to update the test tool shed.
github galaxyproject / planemo / planemo / commands / cmd_docker_build.py View on Github external
@command_function
def cli(ctx, path=".", dockerfile=None, **kwds):
    """Build (and optionally cache) Docker images.

    Loads the tool or tools referenced by ``TOOL_PATH`` (by default all tools
    in current directory), and ensures they all reference the same Docker image
    and then attempts to find a Dockerfile for these tools (can be explicitly
    specified with ``--dockerfile`` but by default it will check the tool's
    directory and the current directory as well).

    This command will then build and tag the image so it is ready to be tested
    and published. The docker_shell command be used to test out the built
    image.

    \b
        % planemo docker_build bowtie2.xml # asssumes Dockerfile in same dir
        % planemo docker_shell --from_tag bowtie2.xml