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.3.tar.gz (23.3 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.3-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liblaf_cherries-3.0.3.tar.gz
  • Upload date:
  • Size: 23.3 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.3.tar.gz
Algorithm Hash digest
SHA256 0fa0285dc3709eee857345307684dfcabd0f45262a1328f216b1c4c24db1a817
MD5 4151ec6bb60ec2e2ccd6faebe172462c
BLAKE2b-256 de56a9f122151c1983ba28e0bd4850aae199bc1c29bb4830f6adbd3cc8582292

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_cherries-3.0.3.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.3-py3-none-any.whl.

File metadata

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

Hashes for liblaf_cherries-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a6cd5da75f6f8c32f485ae9bc85ebd3021b5a8452e13875f0370217b6e1a588e
MD5 330cb9b363889719f9a3c46ae25e0428
BLAKE2b-256 e54e4a1051d4452306605672f5f4752e66e710197590ceabb9674e41806b46b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_cherries-3.0.3-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