Metadata-Version: 2.4
Name: yanex
Version: 0.3.0
Summary: Yet Another Experiment Tracker - A lightweight experiment tracking harness
Author: Thomas
Author-email: Thomas <from+gitgub@tomr.au>
License: MIT
Project-URL: Homepage, https://github.com/rueckstiess/yanex
Project-URL: Repository, https://github.com/rueckstiess/yanex
Project-URL: Documentation, https://github.com/rueckstiess/yanex/blob/main/docs/README.md
Project-URL: Issues, https://github.com/rueckstiess/yanex/issues
Keywords: experiment,tracking,machine-learning,research,reproducibility
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=12.0.0
Requires-Dist: gitpython>=3.1.0
Requires-Dist: dateparser>=1.1.0
Requires-Dist: textual>=0.45.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Provides-Extra: matplotlib
Requires-Dist: matplotlib>=3.5.0; extra == "matplotlib"
Dynamic: author
Dynamic: license-file
Dynamic: requires-python

# Yanex - Yet Another Experiment Tracker

A lightweight, Git-aware experiment tracking system for Python that makes reproducible research effortless.

## Why Yanex?

**Stop losing track of your experiments.** Yanex automatically tracks parameters, results, and code state so you can focus on what matters - your research.

```python
import yanex

# read parameters from config file or CLI arguments
lr = yanex.get_param('lr', default=0.001)
epochs = yanex.get_param('epochs', default=10)

# your experiment code
# ...

# log results, artifacts and figures
yanex.log_results({"step": epoch, "loss", loss, "accuracy": accuracy})
yanex.log_artifact("model.pth", model_path)
yanex.log_matplotlib_figure(fig, "loss_curve.png")
```

Run from the command line:

```bash
# Run with yanex CLI for automatic tracking
yanex run train.py --param lr=10e-3 --param epochs=10
```

That's it. Yanex creates a separate directory for each experiment, saves the logged results and files, stdout and stderr outptus, Python environment information, and even the Git state of your code repository. You can then compare results, search experiments, and reproduce them with ease.

## Key Features

- 🔒 **Reproducible**: Automatic Git state tracking ensures every experiment is reproducible
- 📊 **Interactive Comparison**: Compare experiments side-by-side with an interactive table
- ⚙️ **Flexible Parameters**: YAML configs with CLI overrides for easy experimentation and syntax for parameter sweeps
- 📈 **Rich Logging**: Track metrics, artifacts, and figures
- 🔍 **Powerful Search**: Find experiments by status, parameters, tags, or time ranges
- 📦 **Zero Dependencies**: No external services required - works offline

## Quick Start

### Install
```bash
pip install yanex
```

### 1. Run Your First Experiment

```python
# experiment.py
import yanex

params = yanex.get_params()
print(f"Learning rate: {params.get('learning_rate', 0.001)}")

# Simulate training
accuracy = 0.85 + (params.get('learning_rate', 0.001) * 10)

yanex.log_results({
    "accuracy": accuracy,
    "loss": 1 - accuracy
})
```

```bash
# Run with default parameters
yanex run experiment.py

# Override parameters
yanex run experiment.py --param learning_rate=0.01 --param epochs=50

# Add tags for organization
yanex run experiment.py --tag baseline --tag "quick-test"
```

### 2. Compare Results

```bash
# Interactive comparison table
yanex compare

# Compare specific experiments
yanex compare exp1 exp2 exp3

# Filter and compare
yanex compare --status completed --tag baseline
```

### 3. Track Everything

List, search, and manage your experiments:

```bash
# List recent experiments
yanex list

# Find experiments by criteria
yanex list --status completed --tag production
yanex list --started-after "1 week ago"

# Show detailed experiment info
yanex show exp_id

# Archive old experiments
yanex archive --started-before "1 month ago"
```

## Two Ways to Use Yanex

Yanex supports two usage patterns:

### 1. CLI-First (Recommended)
Write scripts that work both standalone and with yanex tracking:

```python
# train.py - Works both ways!
import yanex

params = yanex.get_params()  # Gets parameters or defaults
lr = params.get('learning_rate', 0.001)

# Your training code
accuracy = train_model(lr=lr)

# Logging works in both contexts
yanex.log_results({"accuracy": accuracy})
```

```bash
# Run standalone (no tracking)
python train.py

# Run with yanex (full tracking)
yanex run train.py --param learning_rate=0.01
```

### 2. Explicit Experiment Creation (Advanced)
For Jupyter notebook usage, or when you need fine control:

```python
import yanex
from pathlib import Path

experiment = yanex.create_experiment(script_path=Path(__file__), name="my-exp", config={"lr": 0.01})

with experiment:
    
    # Your code here
    # ...

    yanex.log_results({"accuracy": 0.95})
```

> **Note:** Don't mix both patterns! Use CLI-first for most cases, explicit creation for advanced scenarios.


## Configuration Files

Create `config.yaml` for default parameters:

```yaml
# config.yaml
model:
  learning_rate: 0.001
  batch_size: 32
  epochs: 100

data:
  dataset: "cifar10"
  augmentation: true

training:
  optimizer: "adam"
  scheduler: "cosine"
```


## Documentation

📚 **[Complete Documentation](docs/README.md)** - Detailed guides and API reference

**Quick Links:**
- [CLI Commands](docs/cli-commands.md) - All yanex commands with examples
- [Python API](docs/python-api.md) - Complete Python API reference  
- [Configuration](docs/configuration.md) - Parameter management and config files
- [Comparison Tool](docs/compare.md) - Interactive experiment comparison
- [Best Practices](docs/best-practices.md) - Tips for effective experiment tracking


## Contributing

Yanex is open source and welcomes contributions! See our [contributing guidelines](CONTRIBUTING.md) for details.

**Built with assistance from [Claude](https://claude.ai).**

## License

MIT License - see [LICENSE](LICENSE) for details.

