hermes.commands.base

hermes.commands.base

Classes

HermesSettings

Root class for HERMES configuration model.

HermesCommand

Base class for a HERMES workflow command.

HermesPlugin

Base class for all HERMES plugins.

HermesHelpSettings

Usage docs: https://docs.pydantic.dev/2.10/concepts/models/

HermesHelpCommand

Show help page 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_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_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, Ellipsis] | 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_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _secrets_dir: pydantic_settings.sources.PathType | None = None, **values: Any)

Bases: pydantic_settings.BaseSettings

Root class for HERMES configuration model.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

logging: Dict
class hermes.commands.base.HermesCommand(parser: argparse.ArgumentParser)

Bases: abc.ABC

Base class for a HERMES workflow command.

Variables:

NAME – The name of the sub-command that is defined here.

command_name: str = ''
settings_class: Type
parser
plugins
settings = None
log
errors = []
init_plugins()

Collect and initialize the plugins available for the HERMES command.

classmethod derive_settings_class(setting_types: Dict[str, Type]) None

Build a new Pydantic data model class for configuration.

This will create a new class that includes all settings from the plugins available.

init_common_parser(parser: argparse.ArgumentParser) None

Initialize the common command line arguments available for all HERMES sub-commands.

Parameters:

parser – The base command line parser used as entry point when reading command line arguments.

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 – The command line sub-parser responsible for the HERMES sub-command.

load_settings(args: argparse.Namespace)

Load settings from the configuration file (passed in from command line).

patch_settings(args: argparse.Namespace)

Process command line options for the settings.

abstract __call__(args: argparse.Namespace)

Execute the HERMES sub-command.

Parameters:

args – The namespace that was returned by the command line parser when reading the arguments.

class hermes.commands.base.HermesPlugin

Bases: abc.ABC

Base class for all HERMES plugins.

settings_class: Type | None = None
abstract __call__(command: HermesCommand) None

Execute the plugin.

Parameters:

command – The command that triggered this plugin to run.

class hermes.commands.base.HermesHelpSettings(/, **data: Any)

Bases: pydantic.BaseModel

Usage docs: https://docs.pydantic.dev/2.10/concepts/models/

A base class for creating Pydantic models.

__class_vars__

The names of the class variables defined on the model.

__private_attributes__

Metadata about the private attributes of the model.

__signature__

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__

The core schema of the model.

__pydantic_custom_init__

Whether the model has a custom __init__ function.

__pydantic_decorators__

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__

The name of the post-init method for the model, if defined.

__pydantic_root_model__

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__

The names of fields explicitly set during instantiation.

__pydantic_private__

Values of private attributes set on the model instance.

class hermes.commands.base.HermesHelpCommand(parser: argparse.ArgumentParser)

Bases: HermesCommand

Show help page and exit.

command_name = 'help'
settings_class
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 – The command line sub-parser responsible for the HERMES sub-command.

__call__(args: argparse.Namespace) None

Execute the HERMES sub-command.

Parameters:

args – The namespace that was returned by the command line parser when reading the arguments.