cookbook()
Write cookbook.json, the ledger of the recipes the project uses.
Usage
cookbook(
*,
root=None,
check=False,
)The cookbook lists every recorded recipe, in run order (upstream first), with its description, inputs, outputs and steps, and the raw inputs the recipes read. It is generated from the record in datapackage.json, so to write it the project must be in sync: if check finds anything other than stray files or a stale catalog or cookbook, nothing is written. Writing an unchanged cookbook leaves the file untouched. Commit it to git, like a lock file.
check=True needs no data: it works on a fresh clone or in CI, where raw/ and the views are not present. It compares cookbook.json with the committed datapackage.json, and also reports recipes whose folder no longer matches their record (edited, added or removed without a sync).
Parameters
root: str | Path | None = None-
The project folder. By default it is found by walking up from the current folder to
datapackage.json. check: bool = False-
Do not write; report whether
cookbook.jsonmatches the project’s recipes. Use it in CI.
Returns
CookbookResult-
A CookbookResult. With
answer, and itscheck=True, itsup_to_dateis thefindingslist recipes whose record is out of date.
Raises
CookbookError-
When writing, the project is not in sync; its
findingssay why. ProjectError-
cookbook.json exists but cannot be read.
ProjectNotFound- No project was found.