Skip to main content

Experiments as files

Cherries records Python experiments in ordinary folders. A run keeps end-of-run input/output copies, its entry script, a Git snapshot, logs and Parquet metrics. Local copies use reflinks when available. Remote archives share SHA-256 contents across projects and keep self-contained Git/LFS repositories.

Requires Linux, Python 3.12+ and Git. Source repositories using Git LFS also need Git LFS installed.

uv add liblaf-cherries

Run a script

Use an experiment repository with this layout:

project/
  .git/
  submodules/
  exp/2026/11/15/example/
    README.md
    src/10-run.py
    data/                 # prepare input files here
    figs/
    tmp/                  # debug intermediates; never saved in runs
  cherries/runs/YYYY/mm/dd/  # saved local runs, partitioned by start date

Ignore cherries/ and each study's data/, figs/ and tmp/ in Git. Put parameters in the script. Save this example as src/10-run.py, prepare data/input.txt, then execute python src/10-run.py:

from pathlib import Path

from liblaf import cherries


class Config(cherries.BaseConfig):
    factor: int = 2
    source: Path = cherries.input("input.txt")
    result: Path = cherries.output("result.txt")


def main(cfg: Config) -> None:
    value = int(cfg.source.read_text()) * cfg.factor
    cfg.result.write_text(str(value))
    cherries.tmp("debug/value.txt").write_text(str(value))
    cherries.log_metric("answer", value)


if __name__ == "__main__":
    cherries.run(main)

input() and output() return absolute paths under the study's data/; fig() uses its figs/. tmp() uses tmp/, creates parent directories and never registers or collects its files. Calls in Config and main behave identically. Registered files are copied at the end and recorded in run.yaml.artifacts with their relative name, SHA-256 and byte size. Paths must stay under the corresponding study data/, figs/ or tmp/ root; prepare outside files there before registering them. run(main) constructs the annotated config and records its values, including absolute paths. Each run's src/ holds just the entry script; refs/cherries/runs/<UUIDv7> preserves the complete end snapshot. The run records start-time and end-time in the machine's local timezone at each instant, with an explicit numeric offset: YYYY-mm-dd HH:MM:SS±HH:MM (for example, 2026-11-15 08:00:00+08:00). start() captures the start; main returning or manual end() captures the end before artifact copying and Git finalization. While running, end-time is null.

For debugging, run DEBUG=1 python src/10-run.py. Cherries constructs the config and calls main once, leaves stdout/stderr in the terminal and returns None. It creates no run directory, logs, metrics, metadata, artifact copies or Git snapshot, and does not serialize the config. Path helpers still use the study workspace; outputs and intermediates remain there. Metric logging does nothing; get_step() and set_step() still work, starting at zero. Exceptions propagate without creating a record. Manual start()/end() supports the same behavior. Only the exact value DEBUG=1 enables this mode when execution starts; changing the environment during execution does not switch it. Debugging also works outside Git with the same <study>/src/<script>.py layout. Normal run(main) returns the saved run directory (Path). Git snapshots exclude study tmp/ alongside data/ and figs/, even when those files are already tracked.

Inspect, explain and archive

cherries list --tag selected --json
cherries show RUN
cherries files RUN
cherries get RUN outputs/result.txt --output ./result.txt
cherries edit RUN --description 'Result checked' --add-tag selected
cherries add RUN analysis.md --as README.md
cherries add RUN figs/loss.png --as assets/loss.png
cherries --remote /mnt/archive/cherries push RUN
cherries --remote /mnt/archive/cherries pull RUN
cherries verify RUN
cherries remove RUN
cherries --remote /mnt/archive/cherries gc --dry-run

After execution, maintain the run's README, reports, assets and figures. Inputs, outputs, source, parameters, start/end times, log, metrics and Git ref stay fixed. Push and pull preserve the exact original strings across destination timezones. Default to Markdown; use HTML for complex layouts or interactive figures. When a run has one report, save it as README.md or README.html at the run root. Use reports/ only for additional reports when the run has multiple reports. The README can serve as an entry point linking detailed reports without repeating their text. Reference images as assets/image.png from the root README and ../assets/image.png from a report directly inside reports/; adjust relative paths for deeper report folders.

Local runs use cherries/runs/YYYY/mm/dd/<UUIDv7>[.tmp]/; remote runs use ROOT/projects/<project-id>/runs/YYYY/mm/dd/<UUIDv7>[.tmp]/. The date comes from the persisted run.yaml start-time in its original local timezone. Finishing after midnight or pushing/pulling across timezones keeps that partition. UUIDv7 remains the run identifier; CLI RUN accepts the ID or a concrete run path. Running experiments use .tmp; completed records drop that suffix. list defaults to completed records; list --unfinished selects .tmp records. remove also removes empty date directories. Only this daily layout is supported. Metrics append and flush to JSONL, then become four-column Parquet at the end. Failures retain .tmp with diagnostic logs and re-raise the original exception. The required artifacts mapping lists inputs, outputs and figs; empty roles use []. Local records keep real files alongside this manifest. Remote records store these payloads only in extensionless CAS objects and resolve logical paths such as outputs/result.txt through the manifest. Pull restores real files. Repeat push updates editable materials and retains remote-only files and figures. Repeat pull preserves existing local materials unless --overwrite is passed; figures merge by name and destination-only figures remain. Payloads are saved before the manifest is published atomically. verify checks recorded hashes and sizes against the actual saved bytes.

The storage specification, Python API and CLI reference describe the exact format and commands.

Development

uv sync
uv run pytest
uv run nox
uv run ruff check .
uv run lint-imports
uv build
uv run zensical build

License

Copyright © 2026 liblaf. MIT.

Metadata

Release files for liblaf-cherries 6.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liblaf-cherries 6.0.0
File Size Uploaded Provenance Actions
liblaf_cherries-6.0.0.tar.gz 24.8 kB With provenance Details for liblaf_cherries-6.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for liblaf-cherries 6.0.0
File Interpreter ABI Platform Actions
liblaf_cherries-6.0.0-py3-none-any.whl Python 3 none any Details for liblaf_cherries-6.0.0-py3-none-any.whl

Total release size: 53.5 kB

Release files / liblaf_cherries-6.0.0.tar.gz

Download URL liblaf_cherries-6.0.0.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a284a63123233018dd3e0e67e800fc99c45d5db6922ca0f1043cfa83878cfdf2
BLAKE2b-256 checksum
How to use checksums
a6dcb6f8aecc9ddaae00ade62a54b004bf82470aa0f35661e473a69c32c99cd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / liblaf_cherries-6.0.0-py3-none-any.whl

Download URL liblaf_cherries-6.0.0-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e6f86c399ff6aeeea301c3eefe59547f6318e78d47823b9b4529898850ba673
BLAKE2b-256 checksum
How to use checksums
1208051ba17d5a7c6b5ae85680219512228a248cf3af930dbb94e040f6612998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for liblaf-cherries 6.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for liblaf_cherries-6.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page