hermes.commands.deposit.base

Module Contents

Classes

BaseDepositPlugin

Base class that implements the generic deposition workflow.

DepositSettings

Generic deposition settings.

HermesDepositCommand

Deposit the curated metadata to repositories.

class hermes.commands.deposit.base.BaseDepositPlugin(command, ctx)

Bases: hermes.commands.base.HermesPlugin

Base class that implements the generic deposition workflow.

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

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

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.

abstract map_metadata() None

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

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 create_initial_version(). False indicates a new version of an existing publication, leading to a call of create_new_version().

By default, this returns True.

create_initial_version() None

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

create_new_version() None

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

update_metadata() None

Update the metadata of the newly created version.

delete_artifacts() None

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

upload_artifacts() None

Upload new artifacts to the target platform.

abstract publish() None

Publish the newly created deposit on the target platform.

class hermes.commands.deposit.base.DepositSettings(/, **data: Any)

Bases: pydantic.BaseModel

Generic deposition settings.

target: str = ''
class hermes.commands.deposit.base.HermesDepositCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Deposit the curated metadata to repositories.

command_name = 'deposit'
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.