Skip to main content

pycaddy

PyPI version Python versions License: MIT

A Python toolbox caddy for experiment tracking, parameter sweeping, and automation tasks.

pycaddy helps you organize machine learning experiments, track runs with unique IDs, sweep hyperparameter grids, and manage experiment artifacts — all with minimal overhead and zero bloat.


Table of Contents


Installation

pip install pycaddy

Requirements: Python ≥ 3.11


Quick Start

Experiment Tracking

from pycaddy.project import Project

# Create a project for organizing experiments
project = Project(root="experiments").ensure_folder()

# Start a new experiment run
session = project.session("train", params={"lr": 0.001, "batch_size": 32})
session.start()

# Your experiment code here
model_path = session.path("model.pt")
# save_model(model_path)

# Mark as completed
session.done()

Parameter Sweeping

from pycaddy.sweeper import DictSweep, StrategyName

# Define parameter space
params = {
    'learning_rate': [0.01, 0.001],
    'batch_size': [16, 32, 64]
}

# Generate all combinations
sweep = DictSweep(parameters=params, strategy=StrategyName.PRODUCT)
for config in sweep.generate():
    print(config)
    # {'learning_rate': 0.01, 'batch_size': 16}
    # {'learning_rate': 0.01, 'batch_size': 32}
    # ... etc

Grid Search with Auto-Resume

from pycaddy.project import Project, ExistingRun

project = Project(root="experiments").ensure_folder()

for config in sweep.generate():
    session = project.session(
        "train",
        params=config,
        existing_run_strategy=ExistingRun.RESUME
    )

    if session.is_done():
        print(f"Skipping completed run: {session.uid}")
        continue

    session.start()
    # train_model(config, checkpoint_path=session.path("checkpoint.pt"))
    session.done()

Key Features

  • Project Management: Structured folder organization with automatic metadata tracking
  • Session Tracking: Track experiment runs with unique IDs, status monitoring, and file attachments
  • Parameter Sweeping: Generate parameter combinations with multiple strategies (product, zip, grid)
  • Auto-Resume: Automatically detect and skip completed runs based on parameter hashing
  • Concurrent Safe: File-based locking for multi-process experiment tracking
  • Lightweight: Minimal dependencies, designed as a focused toolbox
  • Flexible Storage: Choose between subfolder or prefix-based file organization

Core Components

Project & Session

High-level API for organizing experiments into projects and tracking individual runs as sessions.

  • Project: Manages a root folder and creates sessions
  • Session: Represents one experiment run with status tracking and file management

→ Full Project & Session Guide

Ledger

Low-level JSON-backed registry that tracks all experiment runs in a single metadata.json file.

  • Thread/process-safe with file locking
  • Deterministic parameter hashing for run deduplication
  • Fine-grained control for advanced use cases

→ Full Ledger Guide

Parameter Sweeping

Generate parameter configurations with various strategies:

  • PRODUCT: Cartesian product of all parameter values
  • ZIP: Zip parameters together element-wise
  • Custom strategies for advanced sampling

→ Full Parameter Sweeping Guide


Documentation


License

MIT License — see LICENSE file for details.


Links

Metadata

Release files for pycaddy 0.2.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 pycaddy 0.2.0
File Size Uploaded
pycaddy-0.2.0.tar.gz 81.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycaddy 0.2.0
File Interpreter ABI Platform
pycaddy-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 109.9 kB

Release files / pycaddy-0.2.0.tar.gz

Download URL pycaddy-0.2.0.tar.gz
Size 81.2 kB
Tags Source
SHA-256 checksum
How to use checksums
483c35f5a255d650d04bb599fdf96a24d5e3d9606d5d8c3579e9da5ea3cb8382
BLAKE2b-256 checksum
How to use checksums
6baaaf4a15048e8196babc981dfaa95816ab21be4e55f745bcd91a597665c4e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release files / pycaddy-0.2.0-py3-none-any.whl

Download URL pycaddy-0.2.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d54f735298cbb734c142904cf7f4cf0fb4f064a9e02ea2e7891ab29972c33ea
BLAKE2b-256 checksum
How to use checksums
1b9b1654bfed2a4e357a86c9c2c6b8fde838cb46e5dcb284698d454cd6342cf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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