Skip to content

sadda.recipe

Reproducibility primitive: a context manager that links operations inside it to a named recipe_run row, plus a generated .py script at block exit. PROVISIONAL tier.

See the quickstart for a worked example. Design rationale lives in the 2026-05-22 DEVLOG entry "Recipes (F1)".

record

record(project: Any, name: str, parameters: Optional[dict] = None) -> _RecordContext

Opens a recipe block. Returns a context manager — use it in a with statement.

:param project: a :class:sadda.Project. :param name: unique recipe name within the project. Recording the same name twice errors (UNIQUE constraint on recipe_run.name). :param parameters: optional dict of user-supplied metadata, serialised to JSON and recorded in recipe_run.parameters. Not interpreted by sadda; available to your own tooling via :func:get.

list

list(project: Any) -> list[Recipe]

Lists every recipe in the project in id order.

get

get(project: Any, name: str) -> Recipe

Fetches a single recipe by name. Raises if the name isn't found.

script_path

script_path(project: Any, name: str) -> str

Returns the conventional path to a recipe's .py script, whether or not the file exists. Use this to discover where the generator would write.

Recipe

Python-side representation of one recipe_run row.

__doc__ class-attribute

__doc__ = 'Python-side representation of one `recipe_run` row.'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'sadda._native.recipe'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

completed_at property

completed_at

ISO 8601 end timestamp, if the block completed.

error_message property

error_message

On 'error' status, the exception text.

id property

id

Recipe id (primary key in recipe_run).

name property

name

Human-readable name (UNIQUE per project).

parameters property

parameters

Opaque JSON parameters supplied by the caller.

sadda_version property

sadda_version

Sadda version recorded when record() ran.

started_at property

started_at

ISO 8601 start timestamp.

status property

status

'in_progress' | 'ok' | 'error'.

__repr__ method descriptor

__repr__()

Return repr(self).