Skip to main content

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-settings models 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 .series frames and optional mesh .landmarks.json companions with their primary artifacts.
  • Plugin hooks: compose ordered hooks for local snapshots, logging, Git, Comet, or your own integrations.
  • Run profiles: use debug for local work without remote or commit side effects, and default for 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() and cherries.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_NAME sets the human-readable run name; CHERRIES_TAGS attaches a comma-separated tag list to summaries and Comet.
  • Plugins subclass liblaf.cherries.core.Plugin, decorate hooks with liblaf.cherries.core.impl(), and use before or after constraints for deterministic order.

⌨️ Local Development

Open in GitHub Codespaces

gh repo clone liblaf/cherries
cd cherries
mise run install
uv run pytest
mise run lint
mise run docs:build

🔗 Links


📝 License

Copyright © 2026 liblaf.
This project is MIT licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liblaf_cherries-3.0.1.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liblaf_cherries-3.0.1-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file liblaf_cherries-3.0.1.tar.gz.

File metadata

  • Download URL: liblaf_cherries-3.0.1.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

Hashes for liblaf_cherries-3.0.1.tar.gz
Algorithm Hash digest
SHA256 c843434a5ecd9f8330612fce6db00b0b1e82a659bdab01d4240a696913462305
MD5 287898516c897352d75d7f15344148bd
BLAKE2b-256 88fb1a9905d61a1a8649746a7043e96e18881e554af3a97d627b6253ed46ed2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_cherries-3.0.1.tar.gz:

Publisher: python-release.yaml on liblaf/cherries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liblaf_cherries-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for liblaf_cherries-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 245b7621a73da17a99e1dbe2ea7e3bc58a31a77211db798a4916360ae5501297
MD5 d18e4c1cb980fef7bbc629a04f294609
BLAKE2b-256 e0e9c49b28598e6c17485ab13d64e12863da31ac1e9679c10341399559385ed8

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_cherries-3.0.1-py3-none-any.whl:

Publisher: python-release.yaml on liblaf/cherries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page