From d58400df3eec46ea593ad61fd58b19539ca0b841 Mon Sep 17 00:00:00 2001 From: era Date: Mon, 15 Jun 2026 20:53:28 +0530 Subject: [PATCH 1/2] Fix README dataset examples --- README.md | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fd90c82..b2b738a 100644 --- a/README.md +++ b/README.md @@ -45,26 +45,21 @@ print(dataset) # } ``` -Validating an in-memory dataset descriptor: +Validating an in-memory dataset model: ```python -from fairspec import validate_dataset +from fairspec import Dataset, validate_dataset -report = validate_dataset({"resources": "bad"}) +dataset = Dataset(resources=[]) +report = validate_dataset(dataset) print(report.valid) -# False +# True print(report.errors) -# [ -# { -# "type": "metadata", -# "message": "must have type array", -# "jsonPointer": "/resources", -# } -# ] +# [] ``` -Loading a dataset from a remote descriptor and saving it locally as a zip archive, and then using it as a local dataset: +Loading a dataset from Zenodo and saving it locally as a zip archive, and then using it as a local dataset: ```python from fairspec import ( @@ -75,9 +70,7 @@ from fairspec import ( ) archive_path = get_temp_file_path() -source_dataset = load_dataset( - "https://raw.githubusercontent.com/roll/currency-codes/refs/heads/master/datapackage.json", -) +source_dataset = load_dataset("https://zenodo.org/records/10053903") save_dataset_to_zip(source_dataset, archive_path=archive_path) target_dataset = load_dataset_from_zip(archive_path) From fbd91dd4ebbf34d6f1c4c492d85380acda46cab8 Mon Sep 17 00:00:00 2001 From: era Date: Mon, 15 Jun 2026 20:59:39 +0530 Subject: [PATCH 2/2] Clarify dataset loader sources in docs --- docs/python/dataset.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/python/dataset.md b/docs/python/dataset.md index 950a2ac..d67f60d 100644 --- a/docs/python/dataset.md +++ b/docs/python/dataset.md @@ -44,7 +44,7 @@ dataset = Dataset( ## Loading a Dataset -Load a dataset descriptor from a local path or remote URL: +Load a dataset descriptor from a local path or a source supported by one of the dataset plugins: ```python from fairspec import load_dataset @@ -52,12 +52,14 @@ from fairspec import load_dataset # Load from local file descriptor = load_dataset("dataset.json") -# Load from a remote URL -descriptor = load_dataset("https://example.com/dataset.json") +# Load from a supported remote source, such as Zenodo +descriptor = load_dataset("https://zenodo.org/records/10053903") ``` `load_dataset` dispatches to the appropriate plugin based on the source (folder, zip, GitHub, Zenodo, CKAN, …) and returns a `Descriptor` (a dict-like JSON object) or `None` if no plugin recognises the source. +To load an arbitrary local or remote Fairspec descriptor file directly, use `load_dataset_descriptor`. + To get a typed `Dataset` model, validate the descriptor: ```python