Skip to content

Loading

loading

Bundle loading entry points.

Functions:

load_bundle

load_bundle(source: BundleSource, *, schema: BundleSource | None = None, serialization: str | None = None) -> Bundle

Load one bundle from a registered name, JSON file, or JSON stream.

Objects recognized by a GA4GH reference implementation are validated and returned as its Pydantic models. Producer-specific structures and objects containing bundle-local references that cannot be validated independently remain mappings.

Loading is fail-fast. If any recognized GKM object fails reference-model validation, no bundle is returned.

When a schema is provided, it is used to check GKM version compatibility. The bundle is not fully validated against the schema.

Parameters:

Name Type Description Default
source BundleSource

Registered bundle name, file path, or readable JSON stream.

required
schema BundleSource | None

Producer JSON Schema. A registered schema is used when omitted.

None
serialization str | None

Input serialization. Only "json" is supported. When omitted, JSON is assumed.

None

Returns:

Type Description
Bundle

The loaded bundle.

Raises:

Type Description
ga4gh.gkm.bundles.BundleCompatibilityError

If the schema references unsupported GKM product versions.

BundleSerializationError

If the serialization or data shape is unsupported.

ga4gh.gkm.bundles.BundleValidationError

If a recognized GKM object fails validation by its reference implementation.

BundleNotFoundError

If source cannot be found.

load_bundles

load_bundles(*sources: BundleSource) -> dict[str, Bundle]

Load several bundles and key them by their resolved names.

Parameters:

Name Type Description Default
sources BundleSource

Registered bundle names, file paths, or readable JSON streams.

()

Returns:

Type Description
dict[str, Bundle]

Loaded bundles keyed by name.

Raises:

Type Description
BundleConflictError

If two sources resolve to the same name.