Skip to main content

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

Project description

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

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

pycaddy-0.2.0.tar.gz (81.2 kB view details)

Uploaded Source

Built Distribution

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

pycaddy-0.2.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file pycaddy-0.2.0.tar.gz.

File metadata

  • Download URL: pycaddy-0.2.0.tar.gz
  • Upload date:
  • Size: 81.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for pycaddy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 483c35f5a255d650d04bb599fdf96a24d5e3d9606d5d8c3579e9da5ea3cb8382
MD5 3162d2b43b17f6c33ff3449bd40f4588
BLAKE2b-256 6baaaf4a15048e8196babc981dfaa95816ab21be4e55f745bcd91a597665c4e6

See more details on using hashes here.

File details

Details for the file pycaddy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pycaddy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for pycaddy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d54f735298cbb734c142904cf7f4cf0fb4f064a9e02ea2e7891ab29972c33ea
MD5 b58ab03c81ce7d0b71e7b7802a8c5ef3
BLAKE2b-256 1b9b1654bfed2a4e357a86c9c2c6b8fde838cb46e5dcb284698d454cd6342cf8

See more details on using hashes here.

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