# ChecklistBuilder

## class nominal.experimental.compute_as_code.ChecklistBuilder(*, strict=False)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

Collect source checks and publish complete checklist revisions.

Adding checks is local. Source and bindings are captured when added.
`create` publishes a new checklist; `commit` replaces an existing checklist’s definition.
Source strings are compiled with nominal-compute and retained for the frontend code editor.

Parameters:
:   **strict** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)"))

    Reject unused input bindings when True. Missing bindings always raise.

Example

```python
check = CheckDefinition(
    "Overheating", "(temperature > 100).ranges()", priority=Priority.P1,
)
builder = ChecklistBuilder()
builder.add(
    check, inputs={"temperature": ChannelBinding("telemetry", "engine.temperature")},
)
checklist = builder.create(client, "Engine acceptance")
```

### add(check, *, inputs)

Compile and bind a reusable check, capturing its source and channels locally.

Parameters:
:   - **check** ([*CheckDefinition*](https://dev.nominal.io/python/ref/generated/nominal.experimental.compute_as_code.CheckDefinition.md#nominal.experimental.compute_as_code.CheckDefinition "nominal.experimental.compute_as_code._checklists.CheckDefinition"))

      Failure condition and metadata. Source must compile to a range series.
    - **inputs** ([*Mapping*](https://docs.python.org/3/library/typing.html#typing.Mapping "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*,* [*ChannelBinding*](https://dev.nominal.io/python/ref/generated/nominal.experimental.compute_as_code.ChannelBinding.md#nominal.experimental.compute_as_code.ChannelBinding "nominal.experimental.compute_as_code._checklists.ChannelBinding")*]*)

      Map expression names to channels. Missing bindings always fail. Unused
      bindings are omitted, or rejected when the builder has `strict=True`.

Returns:
:   This builder. A failed addition leaves it unchanged.

Raises:
:   - [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError "(in Python v3.15)") – The expression is not a source string or does not produce a range series.
    - [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – Compilation fails, bindings are missing, strict bindings are unused,
      a stable key is blank or duplicated, or the event type is UNKNOWN.

Return type:
:   [*Self*](https://docs.python.org/3/library/typing.html#typing.Self "(in Python v3.15)")

> **Note**
>
> Compilation does not resolve live channels or establish streaming compatibility.
> Alignment, fill, and missing-data behavior follow service defaults. A check’s
> ranges describe violations; absence of data does not establish a passing result.

### commit(checklist, *, commit_message)

Replace a published checklist’s definition with a new commit on main.

Parameters:
:   - **checklist** ([*Checklist*](https://dev.nominal.io/python/ref/generated/nominal.core.Checklist.md#nominal.core.Checklist "nominal.core.checklist.Checklist"))

      Loaded checklist to update, supplying the expected main commit.
    - **commit_message** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Description of this revision.

Returns:
:   The same checklist, refreshed from the response with its new `commit_id`.
    Save the previous ID before committing if you need to execute the earlier version.

Raises:
:   - [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If no checks have been added or the checklist has no loaded commit ID.
    - **conjure_python_client.ConjureHTTPError** – If someone else committed to the checklist since
      it was loaded. The checklist object is not refreshed in that case.

Return type:
:   [*Checklist*](https://dev.nominal.io/python/ref/generated/nominal.core.Checklist.md#nominal.core.Checklist "nominal.core.checklist.Checklist")

> **Note**
>
> This replaces all checks and checklist variables, including content authored in the UI.
> Omitted checks disappear from the new version; earlier versions remain available.
> Reusing a stable key preserves check lineage through renames and expression changes.
> Metadata and streaming settings are not changed by this request.
>
> The service rejects stale writes. This method does not refresh or retry a conflict;
> reconcile your definition with the latest checklist before trying again.
> Every successful call creates a commit, even if the definition is unchanged.
>
> Committing to main can update running streaming evaluations asynchronously. Returning
> confirms the commit, not adoption by every asset. No extra reload is issued by the SDK.

### create(client, name, *, description='', assignee=None, commit_message='', labels=(), properties=None, workspace=None)

Create and publish a new checklist without executing it.

Parameters:
:   - **client** ([*NominalClient*](https://dev.nominal.io/python/ref/generated/nominal.core.NominalClient.md#nominal.core.NominalClient "nominal.core.client.NominalClient"))

      Client used for creation.
    - **name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Display name of the checklist.
    - **description** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Description of the checklist.
    - **assignee** ([*User*](https://dev.nominal.io/python/ref/generated/nominal.core.User.md#nominal.core.User "nominal.core.user.User") *|* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      User or user RID assigned to the checklist. Defaults to the authenticated user.
    - **commit_message** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Message on the initial checklist commit.
    - **labels** ([*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]*)

      Labels applied to the checklist.
    - **properties** ([*Mapping*](https://docs.python.org/3/library/typing.html#typing.Mapping "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]* *|* *None*)

      String properties applied to the checklist.
    - **workspace** ([*Workspace*](https://dev.nominal.io/python/ref/generated/nominal.core.Workspace.md#nominal.core.Workspace "nominal.core.workspace.Workspace") *|* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      Workspace or workspace RID for creation. Defaults to the client’s default workspace.

Returns:
:   The published checklist. Use its `execute` method to initiate a data review.

Raises:
:   [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If no checks have been added.

Return type:
:   [*Checklist*](https://dev.nominal.io/python/ref/generated/nominal.core.Checklist.md#nominal.core.Checklist "nominal.core.checklist.Checklist")

> **Note**
>
> This creates a new resource on every call; it does not update an existing checklist
> or consume the builder. Reuse the returned checklist with `commit` for later revisions.
