Skip to main content

Typed configuration compiler for ML experiments

Project description

Stryx

Stryx is a typed configuration compiler and experiment manager for Machine Learning. It sits between tools like Sacred and Hydra, offering a lightweight, composable approach without the complexity of Hydra's indirection.

Key Features

  • Type-First: Configurations are defined as Pydantic models (or dataclasses), providing IDE support and validation.
  • Recipes as Source: Experiment configurations are compiled into static YAML "recipes" that include metadata and lineage.
  • Minimal Surface: A single decorator (@stryx.cli) adds powerful CLI capabilities to any script.
  • Reproducibility: Defaults are code-driven, overrides are explicit, and recipes track their origin.
  • Lifecycle Management: Automatic manifest recording (git state, logs, config) for every run.

Installation

pip install stryx

Quick Start

Define your configuration schema and decorate your entry point:

# train.py
from pydantic import BaseModel
import stryx

class Config(BaseModel):
    lr: float = 1e-4
    epochs: int = 10

@stryx.cli(schema=Config)
def main(cfg: Config):
    print(f"Training with lr={cfg.lr}, epochs={cfg.epochs}")

if __name__ == "__main__":
    main()

CLI Usage

Your script now has a powerful CLI.

1. New Experiments

Create a reusable recipe (configuration file).

# Create from defaults with overrides
python train.py new my_exp lr=1e-3

# Create without name (auto-generated: exp_001.yaml)
python train.py new --message "Baseline run"

2. Experimentation (try)

Run a quick experimental variant without creating a permanent recipe. These are saved to scratches/.

# Try modifying a specific recipe
python train.py try my_exp epochs=5

# Try modifying defaults
python train.py try lr=5e-4

3. Execution (run)

Run a recipe exactly as defined (strict mode).

python train.py run my_exp

4. Lineage (fork)

Create a new experiment based on an existing one.

python train.py fork my_exp better_exp lr=2e-4 --message "Lower LR"

5. Inspection & Management

  • List: See all recipes and runs.

    python train.py list configs  # List recipes
    python train.py list runs     # List execution history
    
  • Show: Inspect a configuration with annotated sources (default vs recipe vs override).

    python train.py show my_exp
    
  • Diff: Compare two recipes.

    python train.py diff my_exp better_exp
    
  • Schema: Print the configuration schema (or JSON).

    python train.py schema
    python train.py schema --json
    
  • Edit: Open a recipe in an interactive TUI (Terminal UI).

    python train.py edit my_exp
    

CLI Reference

Command Description
new [name] [overrides...] Create a fresh experiment recipe from defaults.
fork <src> <name> [ov...] Fork an existing recipe with modifications.
try [target] [ov...] Run an experimental variant (saved to scratches).
run <target> Run an existing recipe exactly (strict).
list {configs,runs} List saved recipes or execution history.
show [target] [ov...] Display configuration with source annotations.
diff <A> [B] Compare two recipes (or A vs defaults).
schema Show the configuration schema.
edit <recipe> Edit a recipe interactively (TUI).

Global Options

  • --runs-dir: Override directory for run logs and manifests.
  • --configs-dir: Override directory for recipe storage.

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

stryx-0.1.3.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

stryx-0.1.3-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file stryx-0.1.3.tar.gz.

File metadata

  • Download URL: stryx-0.1.3.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for stryx-0.1.3.tar.gz
Algorithm Hash digest
SHA256 abfcdded3d3e1a7365a66a3eae3fc678e63c9c45ba8fcb74b40faa91afa37e4c
MD5 1334cdec12798ec4aa24747b7a3b194d
BLAKE2b-256 40d61f4192459da3e792c4d77dc0b5f8b8c2da8b0eadb89cd31b17c499417f79

See more details on using hashes here.

File details

Details for the file stryx-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: stryx-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for stryx-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3b9cf0822a7559bb7e050a1c927bf1bbf827fdd3b030b898d4df45e56d5ce36c
MD5 2fda1455283a95bc9727e68739fa4eda
BLAKE2b-256 ab0951e8c0f0a275b5d223c586286c14bc0cf63186a5dd4a9f650d7ee9728c16

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