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_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, 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, _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, **values: Any)

   Bases: :py:obj:`pydantic_settings.BaseSettings`


   Root class for HERMES configuration model.


   .. py:attribute:: model_config

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


   .. py:attribute:: logging
      :type:  Dict


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

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


   Base class for a HERMES workflow command.

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


   .. py:attribute:: command_name
      :type:  str
      :value: ''



   .. py:attribute:: settings_class
      :type:  Type


   .. py:attribute:: parser


   .. py:attribute:: plugins


   .. py:attribute:: settings
      :value: None



   .. py:attribute:: log


   .. py:attribute:: errors
      :value: []



   .. py:method:: init_plugins()
      :classmethod:


      Collect and initialize the plugins available for the HERMES command.



   .. py:method:: derive_settings_class(setting_types: Dict[str, Type]) -> 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.



   .. 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.



   .. 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.



   .. py:method:: load_settings(args: argparse.Namespace)

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



   .. py:method:: patch_settings(args: argparse.Namespace)

      Process command line options for the settings.



   .. py:method:: __call__(args: argparse.Namespace)
      :abstractmethod:


      Execute the HERMES sub-command.

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



.. py:class:: HermesPlugin

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


   Base class for all HERMES plugins.


   .. py:attribute:: settings_class
      :type:  Optional[Type]
      :value: None



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


      Execute the plugin.

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



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

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


   !!! abstract "Usage Documentation"
       [Models](../concepts/models.md)

   A base class for creating Pydantic models.

   .. attribute:: __class_vars__

      The names of the class variables defined on the model.

   .. attribute:: __private_attributes__

      Metadata about the private attributes of the model.

   .. attribute:: __signature__

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

   .. attribute:: __pydantic_complete__

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

   .. attribute:: __pydantic_core_schema__

      The core schema of the model.

   .. attribute:: __pydantic_custom_init__

      Whether the model has a custom `__init__` function.

   .. attribute:: __pydantic_decorators__

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

   .. attribute:: __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.

   .. attribute:: __pydantic_parent_namespace__

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

   .. attribute:: __pydantic_post_init__

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

   .. attribute:: __pydantic_root_model__

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

   .. attribute:: __pydantic_serializer__

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

   .. attribute:: __pydantic_validator__

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

   .. attribute:: __pydantic_fields__

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

   .. attribute:: __pydantic_computed_fields__

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

   .. attribute:: __pydantic_extra__

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

   .. attribute:: __pydantic_fields_set__

      The names of fields explicitly set during instantiation.

   .. attribute:: __pydantic_private__

      Values of private attributes set on the model instance.


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

   Bases: :py:obj:`HermesCommand`


   Show help page and exit.


   .. py:attribute:: command_name
      :value: 'help'



   .. py:attribute:: settings_class


   .. 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.



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

      Execute the HERMES sub-command.

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



   .. py:method:: load_settings(args: argparse.Namespace)

      No settings are needed for the help command.



.. 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.


   .. py:attribute:: command_name
      :value: 'version'



   .. py:attribute:: settings_class


   .. py:method:: load_settings(args: argparse.Namespace)

      Pass loading settings as not necessary for this command.



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

      Execute the HERMES sub-command.

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



