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

.. py:module:: hermes.commands


Submodules
----------

.. toctree::
   :maxdepth: 1

   /api/hermes/commands/base/index
   /api/hermes/commands/clean/index
   /api/hermes/commands/cli/index
   /api/hermes/commands/curate/index
   /api/hermes/commands/deposit/index
   /api/hermes/commands/harvest/index
   /api/hermes/commands/init/index
   /api/hermes/commands/marketplace/index
   /api/hermes/commands/postprocess/index
   /api/hermes/commands/process/index


Classes
-------

.. autoapisummary::

   hermes.commands.HermesHelpCommand
   hermes.commands.HermesVersionCommand
   hermes.commands.HermesCleanCommand
   hermes.commands.HermesInitCommand
   hermes.commands.HermesCurateCommand
   hermes.commands.HermesHarvestCommand
   hermes.commands.HermesProcessCommand
   hermes.commands.HermesDepositCommand
   hermes.commands.HermesPostprocessCommand


Package Contents
----------------

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



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

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Clean up caches from previous HERMES runs.


   .. py:attribute:: command_name
      :value: 'clean'



   .. py:attribute:: settings_class


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



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

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Install HERMES onto a project.


   .. py:attribute:: command_name
      :value: 'init'



   .. py:attribute:: settings_class


   .. py:attribute:: folder_info
      :type:  HermesInitFolderInfo


   .. py:attribute:: hermes_was_already_installed
      :type:  bool
      :value: False



   .. py:attribute:: new_created_paths
      :type:  list[pathlib.Path]
      :value: []



   .. py:attribute:: tokens
      :type:  dict


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



   .. py:attribute:: deposit_platform
      :type:  DepositPlatform


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



   .. py:attribute:: git_remote_url
      :value: ''



   .. py:attribute:: git_hoster
      :type:  GitHoster


   .. py:attribute:: template_base_url
      :type:  str
      :value: 'https://raw.githubusercontent.com'



   .. py:attribute:: template_branch
      :type:  str
      :value: 'feature/init-custom-ci'



   .. py:attribute:: template_repo
      :type:  str
      :value: 'softwarepub/ci-templates'



   .. py:attribute:: template_folder
      :type:  str
      :value: 'init'



   .. py:attribute:: ci_parameters
      :type:  dict


   .. py:attribute:: hermes_toml_data


   .. py:attribute:: plugin_relevant_commands
      :value: ['harvest', 'deposit']



   .. py:attribute:: builtin_plugins
      :type:  dict[str:HermesPlugin]


   .. py:attribute:: selected_plugins
      :type:  list[hermes.commands.marketplace.PluginInfo]
      :value: []



   .. 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:: refresh_folder_info() -> None

      Checks the contents of the current directory and saves relevant info in self.folder_info



   .. py:method:: setup_file_logging() -> None


   .. 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:: test_initialization() -> None

      Test if init is possible and wanted. If not: sys.exit()



   .. py:method:: create_hermes_toml() -> None

      Creates the hermes.toml file based on a self.hermes_toml_data



   .. py:method:: create_citation_cff() -> None

      If there is no CITATION.cff, the user gets the opportunity to create one online.



   .. py:method:: update_gitignore() -> None

      Creates .gitignore if there is none and adds '.hermes' to it



   .. py:method:: get_template_url(filename: str) -> str

      Returns the full template url with a given filename.



   .. py:method:: create_ci_template() -> None

      Downloads and configures the ci workflow files using templates from the chosen template branch.



   .. py:method:: configure_ci_template(ci_file_path) -> None

      Replaces all {%parameter%} in a ci file with values from ci_parameters dict



   .. py:method:: create_zenodo_token() -> None

      Makes the user create a zenodo token and saves it in self.tokens.



   .. py:method:: configure_git_project() -> None

      Adds the token to the git secrets & changes action workflow settings.



   .. py:method:: configure_github() -> None


   .. py:method:: configure_gitlab() -> None


   .. py:method:: choose_deposit_platform() -> None

      User chooses his desired deposit platform.



   .. py:method:: integrate_deposit_platform() -> None

      Makes changes to the toml data or something else based on the chosen deposit platform.



   .. py:method:: choose_setup_method() -> None

      User chooses his desired setup method: Either preferring automatic (if available) or manual.



   .. py:method:: connect_deposit_platform() -> None

      Acquires the access token of the chosen deposit platform.



   .. py:method:: choose_plugins() -> None

      User chooses the plugins he wants to use.



   .. py:method:: integrate_plugins() -> None

      Plugin installation is added to the ci-parameters.
      Also for now we use this method to do custom plugin installation steps.



   .. py:method:: no_git_setup(start_question: str = '') -> None

      Makes the init for a gitless project (basically just creating hermes.toml)



   .. py:method:: choose_push_branch() -> None

      User chooses the branch that should be used to activate the whole hermes process.



   .. py:method:: choose_deposit_files() -> None

      User chooses the files that should be included in the deposition.



   .. py:method:: mark_as_new_path(path: pathlib.Path, avoid_existing: bool = True) -> None

      This method should be called directly BEFORE creating a new file in the given Path.
      This way we can look if something already exists there to decide later-on if we want to delete it on abort.



   .. py:method:: clean_up_files(aborted: bool) -> None

      This gets called when init is finished (successfully or aborted).
      It cleans up unwanted files (like .hermes folder) and everything new when aborted.



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

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Curate the unified metadata before deposition.


   .. py:attribute:: command_name
      :value: 'curate'



   .. 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:class:: HermesHarvestCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Harvest metadata from configured sources.


   .. py:attribute:: command_name
      :value: 'harvest'



   .. py:attribute:: settings_class


   .. 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:class:: HermesProcessCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Process the collected metadata into a common dataset.


   .. py:attribute:: command_name
      :value: 'process'



   .. py:attribute:: settings_class


   .. 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:class:: HermesDepositCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Deposit the curated metadata to repositories.


   .. py:attribute:: command_name
      :value: 'deposit'



   .. 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:class:: HermesPostprocessCommand(parser: argparse.ArgumentParser)

   Bases: :py:obj:`hermes.commands.base.HermesCommand`


   Post-process the published metadata after deposition.


   .. py:attribute:: command_name
      :value: 'postprocess'



   .. py:attribute:: settings_class


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



