Persistent memoization by parameter identity for experiment scripts
Project description
stet
A Python library for making parameter sweeps safely resumable.
Stet is a Latin proofreading instruction meaning "let it stand" - written beside a
correction that should be ignored. When stet sees a parameter combination it has
already run, it does the same: leave it, it's done.
When a long-running experiment script is re-run, whether after a crash, a time limit, or
deliberately to extend a sweep, stet automatically skips any parameter combinations
that have already been completed.
import stet
@stet.once(store='markov_runs.csv', key=['alpha', 'n_states', 'seed'])
def solve_markov(alpha, n_states, seed, n_iter=10_000):
# expensive computation
...
for alpha in alphas:
for n_states in [10, 50, 100]:
for seed in range(20):
solve_markov(alpha=alpha, n_states=n_states, seed=seed)
On restart, any already-completed (alpha, n_states, seed) combinations are skipped:
[once] Skipping solve_markov(alpha=0.01, n_states=10, seed=0)
[once] Skipping solve_markov(alpha=0.01, n_states=10, seed=1)
...
Installation
uv add stet
# or: python -m pip install stet
With Parquet support:
uv add stet[parquet]
# or: python -m pip install stet[parquet]
Usage
Zero config: uses _stet_store.csv in the current directory, all parameters as the
key:
@stet.once
def run_experiment(alpha, seed):
...
Named store: backend selected from file extension (.csv, .json, .sqlite,
.parquet):
@stet.once(store='runs.sqlite')
def run_experiment(alpha, seed):
...
Key subset: only alpha and seed determine whether a run is skipped; n_iter is
ignored:
@stet.once(store='runs.csv', key=['alpha', 'seed'])
def run_experiment(alpha, seed, n_iter=1000):
...
Utilities
stet.status() # print a summary of completed runs
stet.reset() # clear the store
stet.reset(key_dict={'alpha': '0.1', 'seed': '42'}) # remove one entry
Storage backends
| Extension | Backend | Notes |
|---|---|---|
.csv |
pandas CSV | Default. Human-readable. |
.json |
stdlib json | No extra dependencies. |
.sqlite |
stdlib sqlite3 | Best for large stores and parallel workers. |
.parquet |
pandas + pyarrow | Requires stet[parquet]. |
Documentation
Full documentation including how-to guides, API reference, and explanation of design decisions: docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stet-0.0.2.tar.gz.
File metadata
- Download URL: stet-0.0.2.tar.gz
- Upload date:
- Size: 144.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0263000b9ddeb61d18b00b8a22677d0321ada154349d731934a18016f0c2ae2b
|
|
| MD5 |
24eeb7133a401e2573fd02a2da5520f3
|
|
| BLAKE2b-256 |
9fc26c293359f203f9d0db69d8311c2af67fc00c8078185fa0a5f5fef8c1cc10
|
Provenance
The following attestation bundles were made for stet-0.0.2.tar.gz:
Publisher:
publish.yml on drvinceknight/stet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stet-0.0.2.tar.gz -
Subject digest:
0263000b9ddeb61d18b00b8a22677d0321ada154349d731934a18016f0c2ae2b - Sigstore transparency entry: 1091184810
- Sigstore integration time:
-
Permalink:
drvinceknight/stet@2fd5005d9d3c3cddc92997c3aa8e41871e7fc016 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/drvinceknight
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2fd5005d9d3c3cddc92997c3aa8e41871e7fc016 -
Trigger Event:
release
-
Statement type:
File details
Details for the file stet-0.0.2-py3-none-any.whl.
File metadata
- Download URL: stet-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24d3bd62c01b6616afc661ca21c40b80733114d5fe4e0dbe7824d714e6a176f4
|
|
| MD5 |
4a5c29d19525600ec42388933c926a3d
|
|
| BLAKE2b-256 |
2ff7961d16c777b2c341fefbfda55224ef656aa26b1d0976a97c3aa88b8f4543
|
Provenance
The following attestation bundles were made for stet-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on drvinceknight/stet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stet-0.0.2-py3-none-any.whl -
Subject digest:
24d3bd62c01b6616afc661ca21c40b80733114d5fe4e0dbe7824d714e6a176f4 - Sigstore transparency entry: 1091184813
- Sigstore integration time:
-
Permalink:
drvinceknight/stet@2fd5005d9d3c3cddc92997c3aa8e41871e7fc016 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/drvinceknight
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2fd5005d9d3c3cddc92997c3aa8e41871e7fc016 -
Trigger Event:
release
-
Statement type: