canvod.store_metadata API Reference¶
Rich provenance metadata for Icechunk stores, aligned with DataCite 4.5, ACDD 1.3, and STAC 1.1.
Package¶
canvod-store-metadata — Store-level provenance for Icechunk stores.
This package manages store metadata: identity, creator, environment, software provenance, and standards compliance (DataCite/ACDD/STAC).
Not to be confused with the file registry in canvod.store
({group}/metadata/table), which tracks individual ingested files.
StoreMetadata
¶
Bases: BaseModel
Root metadata model composing all 11 sections.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/schema.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
to_root_attrs()
¶
Serialize to a JSON-compatible dict for Zarr root attrs.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/schema.py
223 224 225 | |
from_root_attrs(attrs)
classmethod
¶
Reconstruct from Zarr root attrs dict.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/schema.py
227 228 229 230 231 | |
collect_metadata(*, config, site_name, site_config, store_type, source_format, store_path=None, dask_workers=None, dask_threads_per_worker=None)
¶
Collect all metadata sections into a StoreMetadata object.
This is the main entry point for metadata collection.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
write_metadata(store_path, metadata, branch='main')
¶
Write metadata to Icechunk store root attrs.
Returns¶
str Snapshot ID from the commit.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
read_metadata(store_path, branch='main')
¶
Read metadata from Icechunk store root attrs.
Raises¶
KeyError If no metadata found in store.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
update_metadata(store_path, updates, branch='main')
¶
Merge updates into existing metadata.
Supports dotted keys for nested updates (e.g. "temporal.updated").
Returns¶
str Snapshot ID from the commit.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
metadata_exists(store_path, branch='main')
¶
Check if metadata exists in the store.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
102 103 104 105 106 107 108 109 110 111 | |
validate_all(metadata)
¶
Run all validators, return issues grouped by standard.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/validate.py
194 195 196 197 198 199 200 201 | |
scan_stores(root_dir, recursive=True)
¶
Walk directories, find Icechunk stores, build a catalog.
Returns¶
pl.DataFrame One row per store with metadata columns.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/inventory.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
Schema¶
Pydantic models for store metadata (11 sections, ~90 fields).
Aligns with FAIR data principles, DataCite 4.5, ACDD 1.3, STAC 1.1, and W3C PROV.
StoreMetadata
¶
Bases: BaseModel
Root metadata model composing all 11 sections.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/schema.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
to_root_attrs()
¶
Serialize to a JSON-compatible dict for Zarr root attrs.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/schema.py
223 224 225 | |
from_root_attrs(attrs)
classmethod
¶
Reconstruct from Zarr root attrs dict.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/schema.py
227 228 229 230 231 | |
Collectors¶
Runtime collectors — pure functions that gather metadata.
collect_software_versions()
¶
Collect versions of key packages via importlib.metadata.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
collect_python_info()
¶
Return Python version + implementation.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
65 66 67 | |
collect_uv_version()
¶
Return uv version or None if not installed.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
collect_environment(store_path=None, dask_workers=None, dask_threads_per_worker=None)
¶
Collect runtime environment information.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
collect_config_snapshot(config)
¶
Serialize config sections + compute SHA256 hash.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
collect_creator(metadata_config)
¶
Build Creator from MetadataConfig.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
208 209 210 211 212 213 214 215 216 217 218 219 | |
collect_publisher(metadata_config)
¶
Build Publisher from MetadataConfig.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
222 223 224 225 226 227 228 | |
collect_spatial(site_config, site_name)
¶
Build SpatialExtent from SiteConfig.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
collect_instruments(site_config)
¶
Build Instruments from SiteConfig receivers.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
258 259 260 261 262 263 264 265 266 267 268 269 270 | |
collect_processing_provenance(store_type, source_format)
¶
Build ProcessingProvenance.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
collect_references(config)
¶
Build References from config if available.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
collect_metadata(*, config, site_name, site_config, store_type, source_format, store_path=None, dask_workers=None, dask_threads_per_worker=None)
¶
Collect all metadata sections into a StoreMetadata object.
This is the main entry point for metadata collection.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/collectors.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
Store I/O¶
Read/write metadata to/from Icechunk store root attrs.
write_metadata(store_path, metadata, branch='main')
¶
Write metadata to Icechunk store root attrs.
Returns¶
str Snapshot ID from the commit.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
read_metadata(store_path, branch='main')
¶
Read metadata from Icechunk store root attrs.
Raises¶
KeyError If no metadata found in store.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
update_metadata(store_path, updates, branch='main')
¶
Merge updates into existing metadata.
Supports dotted keys for nested updates (e.g. "temporal.updated").
Returns¶
str Snapshot ID from the commit.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
metadata_exists(store_path, branch='main')
¶
Check if metadata exists in the store.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/io.py
102 103 104 105 106 107 108 109 110 111 | |
Validation¶
Validate metadata completeness against FAIR, DataCite 4.5, ACDD 1.3, STAC 1.1.
validate_datacite(metadata)
¶
Check DataCite 4.5 mandatory fields.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/validate.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
validate_acdd(metadata)
¶
Check ACDD 1.3 highly recommended + recommended fields.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/validate.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
validate_stac(metadata)
¶
Check STAC 1.1 Collection required fields.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/validate.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
validate_fair(metadata)
¶
Check FAIR data principles compliance.
Checks each sub-principle (F1–F4, A1–A2, I1–I3, R1.1–R1.3) and returns actionable issues for anything missing.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/validate.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
validate_all(metadata)
¶
Run all validators, return issues grouped by standard.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/validate.py
194 195 196 197 198 199 200 201 | |
Inventory¶
Store catalog builder — scan directories for Icechunk stores.
scan_stores(root_dir, recursive=True)
¶
Walk directories, find Icechunk stores, build a catalog.
Returns¶
pl.DataFrame One row per store with metadata columns.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/inventory.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
scan_stores_as_stac(root_dir)
¶
Build a STAC Catalog JSON dict from stores.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/inventory.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
write_stac_collection(store_path, output_path=None, branch='main')
¶
Write a STAC Collection JSON file for a single store.
Parameters¶
store_path : Path
Path to the Icechunk store.
output_path : Path | None
Output JSON file path. Defaults to store_path / "collection.json".
branch : str
Store branch to read metadata from.
Returns¶
Path The written JSON file path.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/inventory.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
write_stac_catalog(root_dir, output_path=None, write_collections=True)
¶
Write a STAC Catalog JSON and optional per-store Collection JSONs.
Parameters¶
root_dir : Path
Root directory to scan for Icechunk stores.
output_path : Path | None
Output catalog JSON path. Defaults to root_dir / "catalog.json".
write_collections : bool
If True, also write a collection.json next to each store.
Returns¶
Path The written catalog JSON file path.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/inventory.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
Display¶
Human-readable metadata display and query tool.
Usage¶
from canvod.store_metadata import show_metadata
show_metadata("/path/to/store") # full report
show_metadata("/path/to/store", section="env") # just environment
show_metadata("/path/to/store", section="uv") # dump uv.lock
format_metadata(meta, section=None)
¶
Format metadata as a human-readable string.
Parameters¶
meta : StoreMetadata The metadata to format. section : str | None If given, show only this section. Special values: - "uv" / "uv.lock": dump raw uv.lock content - "toml" / "pyproject": dump raw pyproject.toml content - "env-reproduce": print instructions to reproduce env - Any key from _SECTIONS: show that section only If None, show full report.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/show.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
extract_env(store_path, output_dir, branch='main')
¶
Extract pyproject.toml + uv.lock from a store for reproduction.
Parameters¶
store_path : Path Path to the Icechunk store. output_dir : Path Directory to write the files into. branch : str Store branch.
Returns¶
Path
The output directory (ready for uv sync --frozen).
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/show.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
show_metadata(store_path, section=None, branch='main')
¶
Print store metadata to stdout.
Parameters¶
store_path : str | Path Path to an Icechunk store. section : str | None Section to show (None = full report). branch : str Store branch.
Source code in packages/canvod-store-metadata/src/canvod/store_metadata/show.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |