hermes.commands

Contents

hermes.commands

Submodules

Classes

HermesHelpCommand

Show help page and exit.

HermesVersionCommand

Show HERMES version and exit.

HermesCleanCommand

Clean up caches from previous HERMES runs.

HermesInitCommand

Install HERMES onto a project.

HermesCurateCommand

Curate the unified metadata before deposition.

HermesHarvestCommand

Harvest metadata from configured sources.

HermesProcessCommand

Process the collected metadata into a common dataset.

HermesDepositCommand

Deposit the curated metadata to repositories.

HermesPostprocessCommand

Post-process the published metadata after deposition.

Package Contents

class hermes.commands.HermesHelpCommand(parser: argparse.ArgumentParser)

Bases: HermesCommand

Show help page and exit.

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

load_settings(args: argparse.Namespace)

No settings are needed for the help command.

class hermes.commands.HermesVersionCommand(parser: argparse.ArgumentParser)

Bases: HermesCommand

Show HERMES version and exit.

command_name = 'version'
settings_class
load_settings(args: argparse.Namespace)

Pass loading settings as not necessary for this 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.

class hermes.commands.HermesCleanCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Clean up caches from previous HERMES runs.

command_name = 'clean'
settings_class
__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.

load_settings(args: argparse.Namespace)

No settings are needed for the clean command.

class hermes.commands.HermesInitCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Install HERMES onto a project.

command_name = 'init'
settings_class
folder_info: HermesInitFolderInfo
hermes_was_already_installed: bool = False
new_created_paths: list[pathlib.Path] = []
tokens: dict
setup_method: str = ''
deposit_platform: DepositPlatform
git_remote: str = ''
git_remote_url = ''
git_hoster: GitHoster
template_base_url: str = 'https://raw.githubusercontent.com'
template_branch: str = 'feature/init-custom-ci'
template_repo: str = 'softwarepub/ci-templates'
template_folder: str = 'init'
ci_parameters: dict
hermes_toml_data
plugin_relevant_commands = ['harvest', 'deposit']
builtin_plugins: dict[str:HermesPlugin]
selected_plugins: list[hermes.commands.marketplace.PluginInfo] = []
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.

load_settings(args: argparse.Namespace)

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

refresh_folder_info() None

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

setup_file_logging() None
__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.

test_initialization() None

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

create_hermes_toml() None

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

create_citation_cff() None

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

update_gitignore() None

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

get_template_url(filename: str) str

Returns the full template url with a given filename.

create_ci_template() None

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

configure_ci_template(ci_file_path) None

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

create_zenodo_token() None

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

configure_git_project() None

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

configure_github() None
configure_gitlab() None
choose_deposit_platform() None

User chooses his desired deposit platform.

integrate_deposit_platform() None

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

choose_setup_method() None

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

connect_deposit_platform() None

Acquires the access token of the chosen deposit platform.

choose_plugins() None

User chooses the plugins he wants to use.

integrate_plugins() None

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

no_git_setup(start_question: str = '') None

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

choose_push_branch() None

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

choose_deposit_files() None

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

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.

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.

class hermes.commands.HermesCurateCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Curate the unified metadata before deposition.

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

class hermes.commands.HermesHarvestCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Harvest metadata from configured sources.

command_name = 'harvest'
settings_class
__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.

class hermes.commands.HermesProcessCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Process the collected metadata into a common dataset.

command_name = 'process'
settings_class
__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.

class hermes.commands.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.

class hermes.commands.HermesPostprocessCommand(parser: argparse.ArgumentParser)

Bases: hermes.commands.base.HermesCommand

Post-process the published metadata after deposition.

command_name = 'postprocess'
settings_class
__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.