plesty.server.model.catalogue

What the hub catalogue says about a module — the data, not the fetching.

hub-registry serves /api/modules/ (a JSON document with a modules list). CatalogueEntry is one such module as the bench cares about it: what it is called, where it lives, its last release, its compliance standard and how its last check and field tests went. Searching and installing from it is plesty.server.services.catalogue and the presenter; this module only reads the JSON.

Attributes

DEFAULT_INDEX_URL

REQUIRED_STANDARD

INSTALLABLE_CATEGORIES

MANIFEST_SDK

Classes

CatalogueEntry

One module of the hub catalogue.

Functions

_release(→ tuple[int, Ellipsis])

0.5.0 → (0, 5, 0); the release part only, empty when there is none.

parse_catalogue(→ list[CatalogueEntry])

Every entry of a /api/modules/ document (a mapping with modules or a bare list).

Module Contents

plesty.server.model.catalogue.DEFAULT_INDEX_URL = 'https://hub.plesty.net/api/modules/'
plesty.server.model.catalogue.REQUIRED_STANDARD = 'quantum'
plesty.server.model.catalogue.INSTALLABLE_CATEGORIES = ('devices', 'experiments')
plesty.server.model.catalogue.MANIFEST_SDK = (0, 5, 0)
plesty.server.model.catalogue._release(version: str) → tuple[int, Ellipsis]

0.5.0 → (0, 5, 0); the release part only, empty when there is none.

Parameters:

version (str)

Return type:

tuple[int, Ellipsis]

class plesty.server.model.catalogue.CatalogueEntry

One module of the hub catalogue.

Variables:
  • name – Distribution name (plesty-pm100d).

  • slug – Project slug.

  • namespace – GitLab path (plesty/hub/devices/thorlab/pm100d).

  • description – One line.

  • category – devices, analyzers or experiments.

  • vendor – Vendor group for devices (thorlab), else empty.

  • repo_url – Clone URL — what a git install uses.

  • web_url – Project page.

  • version – Latest release version, or empty.

  • latest_tag – Latest tag (v0.2.1), or empty.

  • standard – Compliance standard the module pins (quantum), or empty.

  • checked – Whether a plesty check report is published.

  • gates_ok – Whether that report passed.

  • gates_passed – Gates passed in it.

  • gates_failed – Gates failed in it.

  • field_tests – Number of published field-test reports.

  • sdk_version – The plesty-sdk that report was made with, or empty.

name: str
slug: str = ''
namespace: str = ''
description: str = ''
category: str = ''
vendor: str = ''
repo_url: str = ''
web_url: str = ''
version: str = ''
latest_tag: str = ''
standard: str = ''
checked: bool = False
gates_ok: bool = False
gates_passed: int = 0
gates_failed: int = 0
field_tests: int = 0
sdk_version: str = ''
property publishes_manifest: bool

Whether the module is shown to answer --manifest; true of any non-experiment.

Shown by its published check: passed, on a plesty-sdk that has the Experiment Manifest gate (MANIFEST_SDK).

Return type:

bool

property installable: bool

a device or experiment at the standard, with a repository.

The standard is the gate, not the category: what a bench installs it also runs, and a module that has not met the standard has not shown that it can be. A module the hub lists without one is not offered here until its registry entry says it reached it. An experiment must also publish its manifest (publishes_manifest): one that does not installs, and then cannot be configured.

Type:

Whether the bench offers it

Return type:

bool

property ref: str | None

the latest tag, else the default branch.

Type:

The git ref a fresh install checks out

Return type:

str | None

property quality: str

ok, failing, unchecked.

Type:

One word for listings

Return type:

str

matches(query: str) → bool

Case-insensitive substring match on name, slug, vendor and description.

Parameters:

query (str)

Return type:

bool

classmethod from_registry(raw: collections.abc.Mapping[str, Any]) → CatalogueEntry

Build from one element of the registry’s modules list.

Parameters:

raw (collections.abc.Mapping[str, Any])

Return type:

CatalogueEntry

plesty.server.model.catalogue.parse_catalogue(document: Any) → list[CatalogueEntry]

Every entry of a /api/modules/ document (a mapping with modules or a bare list).

Parameters:

document (Any)

Return type:

list[CatalogueEntry]