hermes.commands.init.base

Contents

hermes.commands.init.base

Attributes

Classes

GitHoster

Generic enumeration.

DepositPlatform

Generic enumeration.

HermesInitFolderInfo

HermesInitSettings

Configuration of the init command.

HermesInitCommand

Install HERMES onto a project.

Functions

is_git_installed()

scout_current_folder(→ HermesInitFolderInfo)

download_file_from_url(url, filepath[, append])

string_in_file(→ bool)

convert_remote_url(→ str)

Takes any url produced by 'git remote get-url origin' and returns a unified version with https & without .git

Module Contents

hermes.commands.init.base.TUTORIAL_URL = 'https://docs.software-metadata.pub/en/latest/tutorials/automated-publication-with-ci.html'
class hermes.commands.init.base.GitHoster

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

Empty
GitHub
GitLab
class hermes.commands.init.base.DepositPlatform

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

Empty
Zenodo
ZenodoSandbox
hermes.commands.init.base.DepositPlatformNames: dict[DepositPlatform, str]
hermes.commands.init.base.DepositPlatformUrls: dict[DepositPlatform, str]
class hermes.commands.init.base.HermesInitFolderInfo
absolute_path: str = ''
has_git: bool = False
git_remote_url: str = ''
git_base_url: str = ''
used_git_hoster: GitHoster
has_hermes_toml: bool = False
has_gitignore: bool = False
has_citation_cff: bool = False
has_readme: bool = False
current_branch: str = ''
current_dir: str = ''
dir_list: list[str] = []
dir_folders: list[str] = []
hermes.commands.init.base.is_git_installed()
hermes.commands.init.base.scout_current_folder() HermesInitFolderInfo
hermes.commands.init.base.download_file_from_url(url, filepath, append: bool = False)
hermes.commands.init.base.string_in_file(file_path, search_string: str) bool
hermes.commands.init.base.convert_remote_url(url: str) str

Takes any url produced by ‘git remote get-url origin’ and returns a unified version with https & without .git

class hermes.commands.init.base.HermesInitSettings(/, **data: Any)

Bases: pydantic.BaseModel

Configuration of the init command.

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

Bases: hermes.commands.base.HermesCommand

Install HERMES onto a project.

command_name = 'init'
settings_class
folder_info: HermesInitFolderInfo
tokens: dict
setup_method: str = ''
deposit_platform: DepositPlatform
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
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()
__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()

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

create_hermes_toml()

Creates the hermes.toml file based on a dictionary

create_citation_cff()

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

update_gitignore()

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

get_template_url(filename: str) str
create_ci_template()

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

configure_ci_template(ci_file_path)

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

get_zenodo_token()
configure_git_project()

Adding the token to the git secrets & changing action workflow settings

configure_github()
configure_gitlab()
choose_deposit_platform()

User chooses his desired deposit platform

choose_setup_method()
connect_deposit_platform()

Acquires the access token of the chosen deposit platform

no_git_setup(start_question: str = '')

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

choose_push_branch()

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

choose_deposit_files()

User chooses the files that should be included in the deposition