Shared CLI tools

vivarium.cluster_tools.core.cli_tools.with_verbose_and_pdb(func)[source]
Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.with_sim_verbosity(func)[source]
Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.resolve_sim_verbosity(sim_verbosity, sim_verbosity_deprecated)[source]

Resolve per-simulation verbosity from the new -s count and the deprecated --sim-verbosity value option.

Returns the resolved verbosity count and emits a deprecation warning if the old value form was used. Raises a click.UsageError if verbosity is supplied both as -s/-ss and via the deprecated --sim-verbosity option.

Return type:

int

Parameters:
  • sim_verbosity (int)

  • sim_verbosity_deprecated (str | None)

vivarium.cluster_tools.core.cli_tools.with_slack_channel(func)[source]

Decorator that adds the --slack-channel option for completion notifications.

Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.with_slack_tag(func)[source]

Decorator that adds the --slack-tag option for completion notifications.

Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.with_slack_mute(func)[source]

Decorator that adds the --no-slack flag to suppress the notification.

Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.validate_slack_options(slack_channel, slack_tag, mute_slack=False)[source]

Validate the mutual constraints among the Slack notification options.

Raises a UsageError if --no-slack is combined with a channel or tag, or if --slack-tag is used without --slack-channel.

Return type:

None

Parameters:
  • slack_channel (str | None)

  • slack_tag (str | None)

  • mute_slack (bool)

vivarium.cluster_tools.core.cli_tools.coerce_to_full_path(ctx, param, value)[source]
Return type:

Path | None

Parameters:
vivarium.cluster_tools.core.cli_tools.pass_shared_options(shared_options)[source]

Allows the user to supply a list of click options to apply to a command.

Return type:

Callable[[Callable[..., None]], Callable[..., None]]

Parameters:

shared_options (list[Callable[[Callable[[...], None]], Callable[[...], None]]])

class vivarium.cluster_tools.core.cli_tools.MinutesOrNone[source]

Click param type to allow user to set time in minutes or None.

name: str = 'minutesornone'

the descriptive name of this type

convert(value, param, ctx)[source]

Converts the value to float seconds from minutes.

If conversion fails, calls the fail method from click.ParamType.

Return type:

float | None

Parameters:
vivarium.cluster_tools.core.cli_tools.load_run_config(ctx, param, value)[source]

Eager callback for --run-config. Loads a YAML file and injects its values as defaults for the current command.

  • Options are set via ctx.default_map so Click’s own type coercion, callbacks, and validation still apply.

  • Arguments (positional params) are handled by setting their default and marking them as not required so Click does not complain about missing positional values.

Return type:

None

Parameters:
vivarium.cluster_tools.core.cli_tools.with_run_config(func)[source]

Decorator that adds the --run-config option to a Click command.

Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.with_workflow_config(func)[source]

Decorator that adds the --config/-c option for workflow YAML files.

Return type:

Callable[..., None]

Parameters:

func (Callable[[...], None])

vivarium.cluster_tools.core.cli_tools.resolve_deprecated_positional(positional_value, option_value, param_name, option_flag)[source]

Resolve a parameter that can be provided as a positional arg (deprecated) or as a keyword option (preferred).

Returns the resolved value and emits a deprecation warning if the positional form was used. Raises click.UsageError if both forms are provided.

Return type:

Any

Parameters:
  • positional_value (Any)

  • option_value (Any)

  • param_name (str)

  • option_flag (str)