registry

export.registry

Export-format registry.

Single source of truth for all SimulationExperiment export backends: serialisation formats (YAML, openMINDS), reports (markdown, PDF), and code generators (TVB, JAX, tvboptim, Julia, NeuroML/LEMS, …).

A backend self-registers an :class:ExportFormat describing:

  • canonical key + aliases (resolution)
  • human label, file extension, MIME type (UI / API)
  • a renderer callable (dispatch)
  • optional flags (supports_with_data, …)

Adding a new backend = importing this module and calling :func:register once. Dispatch (SimulationExperiment.render), discovery (/api/v1/experiments/formats, OntologyAPI), and the extension/UI dropdown all light up automatically.

Attributes

Name Description
Importer
Renderer

Classes

Name Description
ExportFormat Descriptor for an export backend.

ExportFormat

export.registry.ExportFormat(
    key,
    label,
    extension,
    media_type,
    renderer,
    aliases=(),
    supports_with_data=False,
    description='',
    importer=None,
    extensions=(),
)

Descriptor for an export backend.

Methods

Name Description
to_public_dict Serialisable view (without the renderer callable).
to_public_dict
export.registry.ExportFormat.to_public_dict()

Serialisable view (without the renderer callable).

Functions

Name Description
has
keys
list_format_dicts Public dict view of all formats — for API/UI dropdowns.
list_formats Return all registered formats (deduplicated, ordered by canonical key).
load Resolve fmt_key and invoke its importer on path.
register Register fmt under its canonical key and all aliases.
render Convenience: resolve fmt_key and invoke its renderer.
resolve Look up an :class:ExportFormat by canonical key or alias.
resolve_by_extension Look up a format by file suffix (e.g. '.yaml', '.nml').

has

export.registry.has(key)

keys

export.registry.keys()

list_format_dicts

export.registry.list_format_dicts()

Public dict view of all formats — for API/UI dropdowns.

list_formats

export.registry.list_formats()

Return all registered formats (deduplicated, ordered by canonical key).

load

export.registry.load(fmt_key, path, **kwargs)

Resolve fmt_key and invoke its importer on path.

Raises ValueError if the format has no importer registered.

register

export.registry.register(fmt, *, overwrite=False)

Register fmt under its canonical key and all aliases.

Raises ValueError if a key is already taken (unless overwrite).

render

export.registry.render(experiment, fmt_key, **kwargs)

Convenience: resolve fmt_key and invoke its renderer.

resolve

export.registry.resolve(key)

Look up an :class:ExportFormat by canonical key or alias.

resolve_by_extension

export.registry.resolve_by_extension(suffix)

Look up a format by file suffix (e.g. '.yaml', '.nml').

Raises ValueError if no format claims the suffix or if multiple formats claim it ambiguously.