dataset list always returns an empty list because load_dataset returns a dict.
Environment
fairspec 0.1.4 (installed from PyPI)
- Python 3.12.3, Linux
- Reproduced in a clean virtualenv against the published wheel.
Repro
cat > dataset.json <<'JSON'
{ "resources": [ { "name": "products", "data": "products.csv" } ] }
JSON
fairspec dataset validate dataset.json --json # {"valid": true, "errors": []}
fairspec dataset list dataset.json --json # [] <-- expected ["products"]
Root cause
commands/dataset/list_.py does:
dataset = load_dataset(path)
resource_names = [
resource.name or infer_resource_name(resource)
for resource in getattr(dataset, "resources", None) or []
]
but load_dataset() returns a plain dict, so getattr(dict_obj, "resources", None) is always None → the comprehension iterates over [].
from fairspec import load_dataset
ds = load_dataset("dataset.json")
print(type(ds).__name__) # dict
print(getattr(ds, "resources", None)) # None
The dataset script docs (docs/terminal/dataset.md) also show dataset.resources[0].name, which would fail for the same dict-vs-model reason.
Expected: dataset list returns the resource names (e.g. ["products"]).
dataset listalways returns an empty list becauseload_datasetreturns adict.Environment
fairspec0.1.4 (installed from PyPI)Repro
Root cause
commands/dataset/list_.pydoes:but
load_dataset()returns a plaindict, sogetattr(dict_obj, "resources", None)is alwaysNone→ the comprehension iterates over[].The
dataset scriptdocs (docs/terminal/dataset.md) also showdataset.resources[0].name, which would fail for the same dict-vs-model reason.Expected:
dataset listreturns the resource names (e.g.["products"]).