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

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


Classes
-------

.. autoapisummary::

   hermes.commands.deposit.base.BaseDepositPlugin
   hermes.commands.deposit.base._DepositSettings
   hermes.commands.deposit.base.HermesDepositCommand


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

.. py:class:: BaseDepositPlugin(command, ctx)

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


   Base class that implements the generic deposition workflow.

   TODO: describe workflow... needs refactoring to be less stateful!


   .. py:attribute:: command


   .. py:attribute:: ctx


   .. py:method:: __call__(command: hermes.commands.base.HermesCommand) -> None

      Initiate the deposition process.

      This calls a list of additional methods on the class, none of which need to be implemented.



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

      Prepare the deposition.

      This method may be implemented to check whether config and context match some initial conditions.

      If no exceptions are raised, execution continues.



   .. py:method:: map_metadata() -> None
      :abstractmethod:


      Map the given metadata to the target schema of the deposition platform.

      When mapping metadata, make sure to add traces to the HERMES software, e.g. via
      DataCite's ``relatedIdentifier`` using the ``isCompiledBy`` relation. Ideally, the value
      of the relation target should be of the respective type for DOIs in your metadata
      schema, with the value itself being the DOI for the version of the HERMES software
      you are using.



   .. py:method:: is_initial_publication() -> bool

      Decide whether to do an initial publication or publish a new version.

      Returning ``True`` indicates that publication of an initial version will be executed, resulting in a call of
      :meth:`create_initial_version`. ``False`` indicates a new version of an existing publication, leading to a call
      of :meth:`create_new_version`.

      By default, this returns ``True``.



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

      Create an initial version of the publication on the target platform.



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

      Create a new version of an existing publication on the target platform.



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

      Update the metadata of the newly created version.



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

      Delete any superfluous artifacts taken from the previous version of the publication.



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

      Upload new artifacts to the target platform.



   .. py:method:: publish() -> None
      :abstractmethod:


      Publish the newly created deposit on the target platform.



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

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


   Generic deposition settings.


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



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



