hermes.commands.marketplace

Basic CLI to list plugins from the Hermes marketplace.

Attributes

Classes

SchemaOrgModel

Basic model for Schema.org JSON-LD validation and serialization.

SchemaOrgOrganization

Validation and serialization of schema:Organization.

SchemaOrgSoftwareApplication

Validation and serialization of schema:SoftwareApplication.

PluginMarketPlaceParser

Parser for the JSON-LD Schema.org markup used in the marketplace.

PluginInfo

This class contains all the information about a plugin which are needed for the init-Command.

Functions

_doi_is_version_of_concept_doi(→ bool)

Check whether doi is a version of concept_doi.

_is_hermes_reference(reference)

Figure out whether reference refers to HERMES.

_sort_plugins_by_step(→ dict[str, ...)

_plugin_loc(→ str)

main()

get_plugin_infos(→ list[PluginInfo])

Returns a List of PluginInfos which are meant to be used by the init-command.

Module Contents

hermes.commands.marketplace.MARKETPLACE_URL = 'https://hermes.software-metadata.pub/marketplace'
class hermes.commands.marketplace.SchemaOrgModel(/, **data: Any)

Bases: pydantic.BaseModel

Basic model for Schema.org JSON-LD validation and serialization.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

context_: str = None
type_: str = None
id_: str | None = None
model_dump_jsonld()
class hermes.commands.marketplace.SchemaOrgOrganization(/, **data: Any)

Bases: SchemaOrgModel

Validation and serialization of schema:Organization.

This model does not incorporate all possible fields and is meant to be used merely for the purposes of the Hermes marketplace.

type_: str = None
name: str
class hermes.commands.marketplace.SchemaOrgSoftwareApplication(/, **data: Any)

Bases: SchemaOrgModel

Validation and serialization of schema:SoftwareApplication.

This model does not incorporate all possible fields and is meant to be used merely for the purposes of the Hermes marketplace.

type_: str = None
name: str
url: str | None = None
install_url: str | None = None
abstract: str | None = None
author: SchemaOrgOrganization | None = None
is_part_of: SchemaOrgSoftwareApplication | None = None
keywords: List[str] = None
hermes.commands.marketplace.schema_org_hermes
class hermes.commands.marketplace.PluginMarketPlaceParser(*args, **kwargs)

Bases: html.parser.HTMLParser

Parser for the JSON-LD Schema.org markup used in the marketplace.

is_json_ld: bool = False
plugins: List[SchemaOrgSoftwareApplication] = []
handle_starttag(tag, attrs)
handle_endtag(tag)
handle_data(data)
parse_plugins_from_url(url: str = MARKETPLACE_URL, user_agent: str = hermes_user_agent)
hermes.commands.marketplace._doi_is_version_of_concept_doi(doi: str, concept_doi: str) bool

Check whether doi is a version of concept_doi.

The check is performed by requesting doi from the DataCite API and checking whether its related identifier of type IsVersionOf points to concept_doi. This is the case if conecpt_doi is the concept DOI of doi.

hermes.commands.marketplace._is_hermes_reference(reference: SchemaOrgModel | None)

Figure out whether reference refers to HERMES.

hermes.commands.marketplace._sort_plugins_by_step(plugins: list[SchemaOrgSoftwareApplication]) dict[str, list[SchemaOrgSoftwareApplication]]
hermes.commands.marketplace._plugin_loc(_plugin: SchemaOrgSoftwareApplication) str
hermes.commands.marketplace.main()
class hermes.commands.marketplace.PluginInfo

This class contains all the information about a plugin which are needed for the init-Command.

name: str = ''
location: str = ''
step: str = ''
builtin: bool = True
install_url: str = ''
abstract: str = ''
__str__()
get_pip_install_command() str

Returns the pip install command which can be used to install the plugin. Tries to extract the project name from the install_url (PyPI-URL) if possible. Otherwise, it tries to use the location (Git-Project-URL) for the pip install command.

is_valid() bool

Returns True if the plugin can be installed. Maybe we’ll check the actual repository here later to make sure that other things are valid too.

hermes.commands.marketplace.get_plugin_infos() list[PluginInfo]

Returns a List of PluginInfos which are meant to be used by the init-command.