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.2.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.2-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

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

Hashes for liblaf_cherries-3.0.2.tar.gz
Algorithm Hash digest
SHA256 9fb020b3b407180a8d5891f672d7dbc1c6725f4d5e628db94d801be086ed3908
MD5 8913ac4904ee594309cf48707ad4aade
BLAKE2b-256 7f5e28a8ecb537338e42275907d88eb4e5dba68f4575e896ca9699bb36fcdb0e

See more details on using hashes here.

Provenance

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

Hashes for liblaf_cherries-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d343c3046713616d3b82142f7edd4f91a5d00801a04299c36e016c01d79c4bc
MD5 b7c9a16817ca9bef0dee8fb0a660c77e
BLAKE2b-256 ce83e25debaa88fca662a81025de82e29279fb7fc4d4b691c77faddbbfa639cb

See more details on using hashes here.

Provenance

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