hermes.commands.base

Module Contents

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.6/concepts/models/

HermesHelpCommand

Show help page and exit.

class hermes.commands.base.HermesSettings(_case_sensitive: 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_nested_delimiter: str | None = None, _secrets_dir: str | pathlib.Path | None = None, **values: Any)

Bases: pydantic_settings.BaseSettings

Root class for HERMES configuration model.

model_config
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
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
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.6/concepts/models/

A base class for creating Pydantic models.

__class_vars__

The names of classvars defined on the model.

__private_attributes__

Metadata about the private attributes of the model.

__signature__

The signature for instantiating the model.

__pydantic_complete__

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

__pydantic_core_schema__

The pydantic-core schema used to build the SchemaValidator and SchemaSerializer.

__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_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_extra__

An instance attribute with the values of extra fields from validation when model_config[‘extra’] == ‘allow’.

__pydantic_fields_set__

An instance attribute with the names of fields explicitly set.

__pydantic_private__

Instance attribute with the 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.