A lightweight Python experiment runner for typed configs, reproducible artifact paths, scalar metrics, and Comet/Git/local logging.
Project description
✨ What Cherries Does
Cherries is a lightweight experiment runner for Python scripts that need just enough structure to be repeatable. It builds typed config objects, resolves stable data and temporary paths, stores scalar metrics as Polars dataframes, and fans run events out to local files, Git, Comet, and custom plugins.
- Typed configs: pass
pydantic-settingsmodels into experiments and log them as parameters automatically. - Reproducible paths: resolve inputs, outputs, and temporary artifacts below the entrypoint-derived run directory.
- Metric history: log one scalar or nested metric mappings such as
{"train": {"loss": 0.4}}, then read them back as tables. - Artifact bundles: log VTK
.seriesframes and optional mesh.landmarks.jsoncompanions with their primary artifacts. - Plugin hooks: compose ordered hooks for local snapshots, logging, Git, Comet, or your own integrations.
- Run profiles: use
debugfor local work without remote or commit side effects, anddefaultfor the full logging pipeline.
📦 Installation
uv add liblaf-cherries
🚀 Quick Start
from pathlib import Path
from liblaf import cherries
class Config(cherries.BaseConfig):
name: str = "world"
output: Path = cherries.output("hello.txt", mkdir=True)
def experiment(cfg: Config) -> None:
message = f"Hello, {cfg.name}!"
cfg.output.write_text(f"{message}\n")
cherries.log_params({"name": cfg.name})
cherries.log_metric("message_length", len(message))
if __name__ == "__main__":
cherries.main(experiment, profile="debug")
profile="debug" keeps Comet disabled and Git commits off while still copying
the entrypoint, logs, and logged artifacts into .cherries/runs/. The default
profile enables Comet, commits dirty changes when needed, and records the final
Git SHA.
🧭 Core Concepts
cherries.input()logs existing inputs immediately.cherries.output()andcherries.temp()return paths immediately, then log existing files when the run ends.cherries.log_metric()records one scalar;cherries.log_metrics()flattens nested mappings with/.CHERRIES_NAMEsets the human-readable run name;CHERRIES_TAGSattaches a comma-separated tag list to summaries and Comet.- Plugins subclass
liblaf.cherries.core.Plugin, decorate hooks withliblaf.cherries.core.impl(), and usebeforeorafterconstraints for deterministic order.
⌨️ Local Development
gh repo clone liblaf/cherries
cd cherries
mise run install
uv run pytest
mise run lint
mise run docs:build
🔗 Links
📝 License
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 liblaf_cherries-3.0.2.tar.gz.
File metadata
- Download URL: liblaf_cherries-3.0.2.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb020b3b407180a8d5891f672d7dbc1c6725f4d5e628db94d801be086ed3908
|
|
| MD5 |
8913ac4904ee594309cf48707ad4aade
|
|
| BLAKE2b-256 |
7f5e28a8ecb537338e42275907d88eb4e5dba68f4575e896ca9699bb36fcdb0e
|
Provenance
The following attestation bundles were made for liblaf_cherries-3.0.2.tar.gz:
Publisher:
python-release.yaml on liblaf/cherries
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liblaf_cherries-3.0.2.tar.gz -
Subject digest:
9fb020b3b407180a8d5891f672d7dbc1c6725f4d5e628db94d801be086ed3908 - Sigstore transparency entry: 1822857911
- Sigstore integration time:
-
Permalink:
liblaf/cherries@3087e55b7e095c7eb5d8f9172bcce3dd9c7b0d7c -
Branch / Tag:
refs/tags/v3.0.2 - Owner: https://github.com/liblaf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yaml@3087e55b7e095c7eb5d8f9172bcce3dd9c7b0d7c -
Trigger Event:
release
-
Statement type:
File details
Details for the file liblaf_cherries-3.0.2-py3-none-any.whl.
File metadata
- Download URL: liblaf_cherries-3.0.2-py3-none-any.whl
- Upload date:
- Size: 41.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d343c3046713616d3b82142f7edd4f91a5d00801a04299c36e016c01d79c4bc
|
|
| MD5 |
b7c9a16817ca9bef0dee8fb0a660c77e
|
|
| BLAKE2b-256 |
ce83e25debaa88fca662a81025de82e29279fb7fc4d4b691c77faddbbfa639cb
|
Provenance
The following attestation bundles were made for liblaf_cherries-3.0.2-py3-none-any.whl:
Publisher:
python-release.yaml on liblaf/cherries
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liblaf_cherries-3.0.2-py3-none-any.whl -
Subject digest:
1d343c3046713616d3b82142f7edd4f91a5d00801a04299c36e016c01d79c4bc - Sigstore transparency entry: 1822857923
- Sigstore integration time:
-
Permalink:
liblaf/cherries@3087e55b7e095c7eb5d8f9172bcce3dd9c7b0d7c -
Branch / Tag:
refs/tags/v3.0.2 - Owner: https://github.com/liblaf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yaml@3087e55b7e095c7eb5d8f9172bcce3dd9c7b0d7c -
Trigger Event:
release
-
Statement type: