hermes.commands.base
====================

.. py:module:: hermes.commands.base


Classes
-------

.. autoapisummary::

   hermes.commands.base.HermesSettings
   hermes.commands.base.HermesCommand
   hermes.commands.base.HermesPlugin
   hermes.commands.base.HermesHelpSettings
   hermes.commands.base.HermesHelpCommand
   hermes.commands.base.HermesVersionSettings
   hermes.commands.base.HermesVersionCommand


Module Contents
---------------

.. py:class:: 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: :py:obj:`pydantic_settings.BaseSettings`


   Root class for HERMES configuration model.

   .. attribute:: model_config

      The settings config dict for the settings of hermes.

      :type: SettingsConfigDict


.. py:class:: HermesCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`abc.ABC`


   Base class for a HERMES workflow command.

   .. attribute:: command_name

      (class attribute) Only defined here for highlighting, the value of the subclass is is used.

      :type: str

   .. attribute:: settings_class

      (class attribute) The settings class for the general hermes command settings

      :type: type


   .. py:method:: 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.
      :rtype: dict[str, HermesPlugin]



   .. py:method:: derive_settings_class(setting_types: dict[str, type[HermesPlugin]]) -> None
      :classmethod:


      Build a new Pydantic data model class for configuration.

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

      :param settings_types: The settings classes for the plugins.
      :type settings_types: dict[str, type]

      :rtype: None

      :raises ValueError: If the command has no settings.



   .. py:method:: init_common_parser(parser: argparse.ArgumentParser) -> None

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

      :param parser: The base command line parser used as entry point when reading command line
                     arguments.
      :type parser: ArgumentsParser

      :rtype: None



   .. py:method:: 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.

      :param command_parser: The command line sub-parser responsible for the HERMES sub-command.
      :type command_parser: ArgumentParser

      :rtype: None



   .. py:method:: load_settings(args: argparse.Namespace) -> None

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

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None



   .. py:method:: patch_settings(args: argparse.Namespace) -> None

      Process command line options for the settings.

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None



   .. py:method:: __call__(args: argparse.Namespace) -> None
      :abstractmethod:


      Execute the HERMES sub-command.

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None



.. py:class:: HermesPlugin

   Bases: :py:obj:`abc.ABC`


   Base class for all HERMES plugins.

   .. attribute:: plugin_node

      ...

   .. attribute:: settings_class

      The settings_class of the plugin.


   .. py:method:: __call__(command: HermesCommand) -> None
      :abstractmethod:


      Execute the plugin.

      :param command: The command that triggered this plugin to run.
      :type command: HermesCommand

      :rtype: None



.. py:class:: HermesHelpSettings(/, **data: Any)

   Bases: :py:obj:`pydantic.BaseModel`


   Intentionally empty settings class for the help command.


.. py:class:: HermesHelpCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`HermesCommand`


   Show help page and exit.

   .. attribute:: command_name

      (class attribute) The name of the command.

      :type: str

   .. attribute:: settings_class

      (class attribute) The settings class for general help settings.

      :type: type


   .. py:method:: init_command_parser(command_parser: argparse.ArgumentParser) -> None

      Add arguments for help command.

      :param command_parser: The used argument parser.
      :type command_parser: ArgumentParser

      :rtype: None



   .. py:method:: __call__(args: argparse.Namespace) -> None

      Execute the hermes command `self`.

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None



.. py:class:: HermesVersionSettings(/, **data: Any)

   Bases: :py:obj:`pydantic.BaseModel`


   Intentionally empty settings class for the version command.


.. py:class:: HermesVersionCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`HermesCommand`


   Show HERMES version and exit.

   .. attribute:: command_name

      (class attribute) The name of the command.

      :type: str

   .. attribute:: settings_class

      (class attribute) The settings class for general help settings.

      :type: type


   .. py:method:: load_settings(args: argparse.Namespace) -> None

      Pass loading settings as not necessary for this command.

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None



   .. py:method:: __call__(args: argparse.Namespace) -> None

      Execute the hermes command `self`.

      :param args: The namespace that was returned by the command line parser when reading the arguments.
      :type args: Namespace

      :rtype: None



