hermes.commands.base
Classes
Root class for HERMES configuration model. |
|
Base class for a HERMES workflow command. |
|
Base class for all HERMES plugins. |
|
Intentionally empty settings class for the help command. |
|
Show help page and exit. |
|
Intentionally empty settings class for the version command. |
|
Show HERMES version and exit. |
Module Contents
- class hermes.commands.base.HermesSettings(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_prefix_target: pydantic_settings.sources.EnvPrefixTarget | None = None, _env_file: pydantic_settings.sources.DotenvType | None = ENV_FILE_SENTINEL, _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_nested_max_split: int | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: pydantic_settings.sources.CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_show_env_vars: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | Literal['dual', 'toggle'] | None = None, _cli_ignore_unknown_args: bool | None = None, _cli_kebab_case: bool | Literal['all', 'no_enums'] | None = None, _cli_shortcuts: collections.abc.Mapping[str, str | list[str]] | None = None, _secrets_dir: pydantic_settings.sources.PathType | None = None, _build_sources: tuple[tuple[pydantic_settings.sources.PydanticBaseSettingsSource, ...], dict[str, Any]] | None = None, **values: Any)
Bases:
pydantic_settings.BaseSettingsRoot class for HERMES configuration model.
- class hermes.commands.base.HermesCommand(parser: argparse.ArgumentParser)
Bases:
abc.ABCBase class for a HERMES workflow command.
- command_name
(class attribute) Only defined here for highlighting, the value of the subclass is is used.
- Type:
str
- settings_class
(class attribute) The settings class for the general hermes command settings
- Type:
type
- init_plugins() dict[str, type[HermesPlugin]]
Collect and initialize the plugins available for the HERMES command.
- Returns:
A map mapping the plugin name to the plugin class for the current step.
- Return type:
dict[str, HermesPlugin]
- classmethod derive_settings_class(setting_types: dict[str, type[HermesPlugin]]) None
Build a new Pydantic data model class for configuration.
This will create a new class that includes all settings from the plugins available.
- Parameters:
settings_types (dict[str, type]) – The settings classes for the plugins.
- Return type:
None
- Raises:
ValueError – If the command has no settings.
- init_common_parser(parser: argparse.ArgumentParser) None
Initialize the common command line arguments available for all HERMES sub-commands.
- Parameters:
parser (ArgumentsParser) – The base command line parser used as entry point when reading command line arguments.
- Return type:
None
- init_command_parser(command_parser: argparse.ArgumentParser) None
Initialize the command line arguments available for this specific HERMES sub-commands.
You should override this method to add your custom arguments to the command line parser of the respective sub-command.
- Parameters:
command_parser (ArgumentParser) – The command line sub-parser responsible for the HERMES sub-command.
- Return type:
None
- load_settings(args: argparse.Namespace) None
Load settings from the configuration file (passed in from command line).
- Parameters:
args (Namespace) – The namespace that was returned by the command line parser when reading the arguments.
- Return type:
None
- class hermes.commands.base.HermesPlugin
Bases:
abc.ABCBase class for all HERMES plugins.
- abstractmethod __call__(command: HermesCommand) None
Execute the plugin.
- Parameters:
command (HermesCommand) – The command that triggered this plugin to run.
- Return type:
None
- class hermes.commands.base.HermesHelpSettings(/, **data: Any)
Bases:
pydantic.BaseModelIntentionally empty settings class for the help command.
- class hermes.commands.base.HermesHelpCommand(parser: argparse.ArgumentParser)
Bases:
HermesCommandShow help page and exit.
- class hermes.commands.base.HermesVersionSettings(/, **data: Any)
Bases:
pydantic.BaseModelIntentionally empty settings class for the version command.
- class hermes.commands.base.HermesVersionCommand(parser: argparse.ArgumentParser)
Bases:
HermesCommandShow HERMES version and exit.