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
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.1.tar.gz.
File metadata
- Download URL: stryx-0.1.1.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0f4e3e2aedffb17a9578556e37e9836bab9ed4c7408e7162dd39536f7109f4a
|
|
| MD5 |
6f3de96102268e9bb097fba8dc5634c8
|
|
| BLAKE2b-256 |
f1e1b3c378205ad4dca723379726827c36d50ae515070281939d51d4d5dde154
|
File details
Details for the file stryx-0.1.1-py3-none-any.whl.
File metadata
- Download URL: stryx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c684115c5b7b8daffa8b09a29f3636ce28f6c59adcf3381d5f320dc2b71e0e3
|
|
| MD5 |
adab3ee01315611df6439fb74d3f5b47
|
|
| BLAKE2b-256 |
4dc5c03866bb8ff362b098e3407beea364cc2dee21dfcd074911f6f3fb745c8a
|