Typed configuration compiler for ML experiments
Project description
Stryx
Stryx is a typed configuration compiler and experiment manager for Machine Learning. It provides a lightweight, composable approach to experiment tracking and configuration, using Pydantic for validation and YAML for persistence.
Key Features
- Type-First: Configurations are defined as Pydantic models, providing IDE support and validation.
- Configs as Source: Experiment configurations are compiled into static YAML "configs" 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 every run is recorded with a manifest (git state, logs, absolute paths).
- Lifecycle Management: Automatic recording of status, results, and system metadata for every execution.
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 structured CLI.
1. Running Experiments (run)
Execute an experiment. If you provide overrides, Stryx automatically creates a "scratch" config to track the variant.
# Run with defaults
python train.py run
# Run with overrides (creates a scratch config)
python train.py run lr=1e-3 epochs=50
# Run a specific named config
python train.py run my_exp
2. Config Management (configs)
Manage your experiment templates (recipes).
# Initialize a new config from defaults
python train.py configs init my_exp lr=1e-3
# Fork an existing config
python train.py configs fork my_exp better_exp lr=2e-4
# List all saved configs
python train.py configs list
# Inspect a config with source annotations
python train.py configs show my_exp
# Print the JSON schema for VS Code validation
python train.py configs schema --json
3. Run Management (runs)
Inspect and compare execution history.
# List all runs
python train.py runs list
# Show detailed info for a specific run
python train.py runs show run_20260101_120000
# Diff two runs to see what changed
python train.py runs diff run_A run_B
CLI Reference
Top-level Commands
| Command | Description |
|---|---|
run [config] [ov...] |
Execute an experiment (alias for runs exec). |
configs |
Subcommands for managing configuration files. |
runs |
Subcommands for managing execution history. |
Configs Subcommands (configs ...)
| Command | Description |
|---|---|
init [name] [ov...] |
Create a fresh config file from defaults. |
fork <src> <name> [ov...] |
Fork an existing config with modifications. |
list |
List all saved configs and scratches. |
show [name] [ov...] |
Display config with source annotations. |
diff <A> [B] |
Compare two configs (or A vs defaults). |
schema |
Show the configuration schema (use --json for files). |
Runs Subcommands (runs ...)
| Command | Description |
|---|---|
exec [config] [ov...] |
Execute an experiment. |
list |
List execution history and statuses. |
show <run_id> |
Show configuration and metadata for a run. |
diff <id_A> <id_B> |
Compare configuration between two runs. |
Global Options
--runs-dir: Override directory for run logs and manifests (default:runs/).--configs-dir: Override directory for config storage (default:configs/).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stryx-0.1.4.tar.gz.
File metadata
- Download URL: stryx-0.1.4.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63b97e8d394bb4e16438a4fc714e8b4ca559ebbb71669fd3627fb6c8ceab9383
|
|
| MD5 |
f4326bb7bce6ec10387fd7af3a94b13a
|
|
| BLAKE2b-256 |
1853af3093be0d900b3d5fdd49d7d9464a3c213877cfac6487e17bd9f73636db
|
File details
Details for the file stryx-0.1.4-py3-none-any.whl.
File metadata
- Download URL: stryx-0.1.4-py3-none-any.whl
- Upload date:
- Size: 29.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0da397f75fe05edd8b30796f9a8a269e396ce8409a8871898ac48b2748df0daf
|
|
| MD5 |
09338075b5788ca59dce4d57f621f46e
|
|
| BLAKE2b-256 |
7ef6362dd87fd565a2061ebd1b08439404fcdd678483ef0536a6ce887ef5a2b9
|