Skip to content

plaid.viewer.config

plaid.viewer.config

Runtime configuration for the dataset viewer.

plaid.viewer.config.ViewerConfig dataclass

ViewerConfig(
    datasets_root=None,
    export_version="1",
    extra_cache_key_fields=dict(),
    browse_roots=(),
    allow_root_change=True,
    initial_dataset_id=None,
    allow_dataset_change=True,
)

Static configuration for a viewer instance.

Attributes:

  • datasets_root (Path | None) –

    Directory scanned to discover datasets. A dataset is a subdirectory containing both data/ and problem_definitions/ (or the root may itself be such a folder). When None, the viewer starts without a root and the user is expected to pick one interactively (when allow_root_change is True).

  • export_version (str) –

    Opaque string mixed into the artifact cache key. Bump when export logic changes.

  • extra_cache_key_fields (dict[str, str]) –

    Extra fields serialised into the cache key.

  • browse_roots (tuple[Path, ...]) –

    Directories the viewer is allowed to expose through the built-in file browser / datasets-root text field. Every candidate path must be a descendant of at least one of these roots. When empty, defaults to (Path.home(),) at the service level.

  • allow_root_change (bool) –

    When True (default), the trame UI exposes a panel to change the datasets root at runtime. Set to False for public deployments (e.g. Hugging Face Spaces) where the root must remain fixed to what the operator configured.

  • initial_dataset_id (str | None) –

    Dataset selected when the viewer starts. When None, the first discovered local dataset is selected, falling back to the first Hub dataset.

  • allow_dataset_change (bool) –

    When True (default), the trame UI exposes the dataset dropdown. Set to False to pin the selection configured by initial_dataset_id / startup discovery.