Skip to content

Registry

registry

Registry of named bundles.

Classes

BundleRegistration dataclass

BundleRegistration(name: str, source: Path, schema: Path | None = None, producer: str | None = None, description: str | None = None)

Associate a bundle name with its source and schema.

Parameters:

Name Type Description Default
name str

Public name used to load the bundle.

required
source Path

Path to its serialized document.

required
schema Path | None

Path to its producer JSON Schema, when available.

None
producer str | None

Organization that produced the data, when known.

None
description str | None

Short description of the bundle, when available.

None

BundleRegistry

BundleRegistry()

Mutable registry of named bundle sources.

Create an empty bundle registry.

Methods:
register
register(registration: BundleRegistration, *, replace: bool = False) -> None

Register a named bundle.

Parameters:

Name Type Description Default
registration BundleRegistration

Bundle name and source information.

required
replace bool

Replace an existing registration with the same name.

False

Raises:

Type Description
BundleConflictError

If the name exists and replace is false.

registered_names
registered_names() -> tuple[str, ...]

Return registered bundle names.

Returns:

Type Description
tuple[str, ...]

Registered names in alphabetical order.

get_registration
get_registration(name: str) -> BundleRegistration

Return a bundle registration by name.

Parameters:

Name Type Description Default
name str

Registered bundle name.

required

Returns:

Type Description
BundleRegistration

The matching registration.

Raises:

Type Description
BundleNotFoundError

If name is not registered.