manifest
manifest
Dataset manifests: declaration, discovery, and model-level fetching.
Datasets are declared in TOML manifests. fwl-io ships one manifest for
datasets shared by several models (spectral files, multi-consumer lookup
tables); each model package may ship its own manifest for data only it
consumes and expose it through the fwl_io.manifests entry-point group.
Adding data to a model therefore never requires an fwl-io release.
Manifest schema, one table per dataset, identified by its zenodo key::
manifest_schema = 1 # optional, see below
[interior.eos.wolf_bower_2018]
name = "Wolf & Bower (2018) MgSiO3 equation of state"
zenodo = "10.5281/zenodo.1234567" # version DOI, never a concept DOI
dataverse = "10.34894/ABCDEF" # optional download mirror
required_by = ["aragog", "zalmoxis", "spider"]
extract = "tar" # optional: unpack a single-archive deposit
The optional root manifest_schema names the schema the file was written
against. A manifest that declares one is held to it: only the schema the
installed fwl-io implements is accepted, a higher number meaning the reader is
too old and a lower one meaning the manifest was written for a schema that
stopped loading when the number rose. That is what sharpens the diagnosis
elsewhere, since an unknown field in such a manifest can only be a
misspelling.
The dotted table key is the dataset location below the data root: the table
above resolves into interior/eos/wolf_bower_2018. Key segments are
restricted to letters, digits, _ and -, each starting with a letter,
digit or _, so a key can neither escape the data root nor split into an
unintended path depth. A dataset resolves into <key-as-path>/r<record-id>,
the version directory named for its Zenodo record.
A deposit packaged as one archive declares extract = "tar" or "zip"; its
registry lists the archive, and the fetcher downloads and checksum-verifies it,
then extracts the members into the dataset directory (the archive is not kept).
Every dataset requires a Zenodo version DOI: the committed registry is
generated from the Zenodo record, so Dataverse is a download mirror, not an
alternative primary source. Version DOIs are pinned deliberately: a Zenodo
concept DOI resolves to the newest deposit and would let data drift
underneath pinned code, so fwl-io sync rejects concept DOIs.
Every dataset has a committed registry file next to the manifest, named
<dotted-key>.registry.txt, generated by fwl-io sync. Packages that
ship their own manifest must ship the registry files with it (include both
in package-data).
Dataset(*, key, name, zenodo=None, dataverse=None, required_by=tuple(), registry_path=None, extract=None)
dataclass
A single downloadable dataset declared in a manifest.
subdir
property
Dataset location below the data root, derived from the dotted key.
registry()
Return the committed name-to-hash registry for this dataset.
Source code in src/fwl_io/manifest.py
234 235 236 237 238 239 240 | |
ManifestSchemaError
Bases: ValueError
A manifest and the installed fwl-io disagree about the manifest schema.
Raised when a manifest declares something this fwl-io does not understand, something it no longer understands, or a field it reads only inside a dataset table. Subclasses ValueError, so callers that already handle a malformed manifest keep working.
discover_manifests()
Collect datasets from every installed fwl_io.manifests entry point.
Entry points must resolve to a zero-argument callable returning the manifest path. A provider whose manifest fails to load is skipped with a logged warning, so one broken package cannot break data access for every other model.
Source code in src/fwl_io/manifest.py
436 437 438 439 440 441 442 443 444 445 | |
fetch_for(model, data_root=None)
Fetch every dataset a given model requires; return paths per dataset.
All matching datasets are attempted; failures are collected and raised together at the end so one broken dataset does not block the others (files fetched before the error remain in place).
An unreadable manifest counts as a failure here, even when other datasets arrived: a manifest that cannot be parsed may be the one declaring this model, and a model is routinely served by both its own manifest and the shared one. Listing is more forgiving, since it reports per provider and a reader can see which one is missing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Model name matched (case-insensitively) against |
required |
data_root
|
str | Path | None
|
Override for the data root; defaults to the resolved FWL_DATA tree. |
None
|
Source code in src/fwl_io/manifest.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
load_manifest(path)
Load and validate all datasets declared in one manifest file.
Source code in src/fwl_io/manifest.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
shared_manifest_path()
Entry-point target: the manifest of datasets shared across models.
Source code in src/fwl_io/manifest.py
417 418 419 | |
zenodo_record_id(doi)
Return the numeric record id of a Zenodo version DOI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doi
|
str
|
A Zenodo DOI of the form |
required |
Returns:
| Type | Description |
|---|---|
str
|
The trailing record-id digits. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When the string is not a Zenodo DOI. |
Source code in src/fwl_io/doi.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |