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

Classes

CatalogueEntry

One module of the hub catalogue.

Functions

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

  • categorydevices, 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.

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
property installable: bool

a device at the required standard with a repository.

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]