Shared CLI tools

vivarium_cluster_tools.cli_tools.with_verbose_and_pdb(func)[source]
Return type:

Callable[..., None]

Parameters:

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

vivarium_cluster_tools.cli_tools.with_sim_verbosity(func)[source]
Return type:

Callable[..., None]

Parameters:

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

vivarium_cluster_tools.cli_tools.coerce_to_full_path(ctx, param, value)[source]
Return type:

Path | None

Parameters:
vivarium_cluster_tools.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.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.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.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.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)