> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/sdks/dataset-versions.md).

# Dataset versions

### Version history in the product

![Dataset history with published versions and membership deltas](https://292810646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2FVlkSuopZNbC9JUP9uVx1%2Fdataset-history.png?alt=media\&token=27ae53b7-17d1-45dc-a93b-200509328987)

*Dataset history is the visual counterpart to `dataset.versions()` and version-specific item reads: publisher, timestamp, item count, delta, activity, and exact version actions remain auditable.*

{% hint style="info" %}
**Outcome:** Publish immutable dataset snapshots and inspect exact version membership.
{% endhint %}

```python
version = dataset.publish_version(
    "Added edge cases",
    description="Reviewed false-negative cohort",
)

for item in dataset.versions():
    print(item.version_number, item.title)

for member in version.items():
    print(member.id, member.name)

attached = client.attach_dataset(project, dataset, version=version.version_number)
```

`dataset.list_items(version=N)` and `DatasetVersion.items()` read a published snapshot. `client.attach_dataset(..., version="latest")` attaches the current published version; pass an integer when reproducibility matters.

### Operating contract

| Concern           | Required behavior                                                                |
| ----------------- | -------------------------------------------------------------------------------- |
| Execution surface | Pinned `unitlab==3.0.0` application environment on Python 3.10+.                 |
| Identity          | Least-privilege API key supplied through approved configuration.                 |
| Target resolution | Stable resource IDs and an explicitly bounded target set.                        |
| Success evidence  | Typed return fields, server-side state, and downstream acceptance of the result. |

### Failure and recovery boundary

| Condition                                       | Response                                                                                                     |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Authentication or authorization fails           | Stop, correct the service identity or access model, rotate exposed credentials, and rerun a read-only check. |
| Validation or entitlement rejects the operation | Correct the input or entitlement; do not retry an unchanged request.                                         |
| A request times out                             | Inspect remote state before repeating a mutation because the server may have accepted it.                    |
| Asynchronous processing exceeds its deadline    | Preserve the Batch Queue or release ID, continue bounded monitoring, and inspect item-level failures.        |
| Only part of a batch succeeds                   | Keep successful identifiers, isolate failed rows, and retry only the corrected subset.                       |

{% hint style="warning" %}
Pin and test the production SDK version. Use stable IDs, keep secrets out of logs and command history, and record the correlation ID, target IDs, counts, final state, and redacted error details for material state changes.
{% endhint %}
