ymp.cli package

ymp.cli.install_completion(ctx, attr, value)[source]

Installs click_completion tab expansion into users shell

ymp.cli.install_profiler(ctx, attr, value)[source]

Submodules

ymp.cli.env module

ymp.cli.env.get_env(envname)[source]

Get single environment matching glob pattern

Parameters

envname – environment glob pattern

ymp.cli.env.get_envs(patterns=None)[source]

Get environments matching glob pattern

Parameters

envnames – list of strings to match

ymp.cli.init module

Implements subcommands for ymp init

ymp.cli.init.have_command(cmd)[source]

ymp.cli.make module

Implements subcommands for ymp make and ymp submit

class ymp.cli.make.TargetParam[source]

Bases: click.types.ParamType

Handles tab expansion for build targets

classmethod complete(ctx, incomplete)[source]

Try to complete incomplete command

This is executed on tab or tab-tab from the shell

Parameters
  • ctx – click context object

  • incomplete – last word in command line up until cursor

Returns

list of words incomplete can be completed to

exception ymp.cli.make.YmpConfigNotFound[source]

Bases: ymp.exceptions.YmpException

Exception raised by YMP if no config was found in current path

ymp.cli.make.debug(msg, *args, **kwargs)[source]
ymp.cli.make.snake_params(func)[source]

Default parameters for subcommands launching Snakemake

ymp.cli.make.start_snakemake(kwargs)[source]

Execute Snakemake with given parameters and targets

Fixes paths of kwargs[‘targets’] to be relative to YMP root.

ymp.cli.shared_options module

class ymp.cli.shared_options.Group(name=None, commands=None, **attrs)[source]

Bases: click.core.Group

command(*args, **kwargs)[source]

A shortcut decorator for declaring and attaching a command to the group. This takes the same arguments as command() but immediately registers the created command with this instance by calling into add_command().

class ymp.cli.shared_options.Log[source]

Bases: object

Set up Logging

classmethod logfile_option(ctx, param, val)[source]
mod_level(n)[source]
classmethod quiet_option(ctx, param, val)[source]
static set_logfile(filename)[source]
classmethod verbose_option(ctx, param, val)[source]
class ymp.cli.shared_options.LogFormatter[source]

Bases: coloredlogs.ColoredFormatter

Initialize a ColoredFormatter object.

Parameters
  • fmt – A log format string (defaults to DEFAULT_LOG_FORMAT).

  • datefmt – A date/time format string (defaults to None, but see the documentation of BasicFormatter.formatTime()).

  • style – One of the characters %, { or $ (defaults to DEFAULT_FORMAT_STYLE)

  • level_styles – A dictionary with custom level styles (defaults to DEFAULT_LEVEL_STYLES).

  • field_styles – A dictionary with custom field styles (defaults to DEFAULT_FIELD_STYLES).

Raises

Refer to check_style().

This initializer uses colorize_format() to inject ANSI escape sequences in the log format string before it is passed to the initializer of the base class.

format(record)[source]

Apply level-specific styling to log records.

Parameters

record – A LogRecord object.

Returns

The result of logging.Formatter.format().

This method injects ANSI escape sequences that are specific to the level of each log record (because such logic cannot be expressed in the syntax of a log format string). It works by making a copy of the log record, changing the msg field inside the copy and passing the copy into the format() method of the base class.

snakemake_level_styles = {'crirical': {'color': 'red'}, 'debug': {'color': 'blue'}, 'error': {'color': 'red'}, 'info': {'color': 'green'}, 'warning': {'color': 'yellow'}}
class ymp.cli.shared_options.TqdmHandler(stream=None)[source]

Bases: logging.StreamHandler

Tqdm aware logging StreamHandler

Passes all log writes through tqdm to allow progress bars and log messages to coexist without clobbering terminal

Initialize the handler.

If stream is not specified, sys.stderr is used.

emit(record)[source]

Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

ymp.cli.shared_options.command(*args, **kwargs)[source]
ymp.cli.shared_options.enable_debug(ctx, param, val)[source]
ymp.cli.shared_options.group(*args, **kwargs)[source]
ymp.cli.shared_options.log_options(f)[source]
ymp.cli.shared_options.nohup(ctx, param, val)[source]

Make YMP continue after the shell dies.

  • redirects stdout and stderr into pipes and sub process that won’t die if it can’t write to either anymore

  • closes stdin

ymp.cli.show module

Implements subcommands for ymp show

class ymp.cli.show.ConfigPropertyParam[source]

Bases: click.types.ParamType

Handles tab expansion for ymp show arguments

complete(_ctx, incomplete)[source]

Try to complete incomplete command

This is executed on tab or tab-tab from the shell

Parameters
  • ctx – click context object

  • incomplete – last word in command line up until cursor

Returns

list of words incomplete can be completed to

convert(value, param, ctx)[source]

Convert value of param given context

Parameters
  • value – string passed on command line

  • param – click parameter object

  • ctx – click context object

property properties

Find properties offered by ConfigMgr

ymp.cli.show.show_help(ctx, _param=None, value=True)[source]

Display click command help

ymp.cli.stage module

ymp.cli.stage.wrap(header, data)[source]