Metadata-Version: 2.4
Name: optuna-lightning-cli
Version: 0.1.0
Summary: A Typer CLI application for tuning Lightning modules with Optuna.
Requires-Python: >=3.10
Requires-Dist: jsonargparse[signatures]>=4.27
Requires-Dist: lightning>=2.0
Requires-Dist: optuna-integration[pytorch-lightning]>=4.0
Requires-Dist: optuna>=3.0
Requires-Dist: rich>=13.0
Requires-Dist: torch>=2.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: mlflow; extra == 'dev'
Requires-Dist: pre-commit>=4.6.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0.12.20260518; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocs>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
Provides-Extra: examples
Requires-Dist: torchvision>=0.15; extra == 'examples'
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

# optuna-lightning-cli

[![CI](https://github.com/LukeCPadmore/optuna-lightning-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/LukeCPadmore/optuna-lightning-cli/actions/workflows/ci.yml)
[![Docs](https://github.com/LukeCPadmore/optuna-lightning-cli/actions/workflows/docs.yml/badge.svg)](https://github.com/LukeCPadmore/optuna-lightning-cli/actions/workflows/docs.yml)
[![Publish](https://github.com/LukeCPadmore/optuna-lightning-cli/actions/workflows/publish.yml/badge.svg)](https://github.com/LukeCPadmore/optuna-lightning-cli/actions/workflows/publish.yml)
[![PyPI](https://img.shields.io/pypi/v/optuna-lightning-cli.svg)](https://pypi.org/project/optuna-lightning-cli/)
[![Python](https://img.shields.io/pypi/pyversions/optuna-lightning-cli.svg)](https://pypi.org/project/optuna-lightning-cli/)
[![Docs site](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://lukecpadmore.github.io/optuna-lightning-cli/)

A small Typer CLI for tuning `lightning.pytorch` modules with Optuna.

Install the MNIST example extra and run the sample HPO flow:

```bash
pip install -e ".[examples]"

optuna-lightning tune \
  --training-config examples/mnist-training.yaml \
  --optuna-config examples/mnist-optuna.yaml
```

`MnistClassifier` owns the training loop (`training_step`,
`validation_step`, and `configure_optimizers`). `MnistDataModule` owns the
MNIST download and data loaders. The CLI validates the config pair, patches
Optuna samples into the flat training config, and hands everything to
`Trainer.fit()`.

`print-config` renders the normalized Lightning config under a `Lightning
Base Config` header and the Optuna config under an `Optuna Config` header.

The CLI also includes config printing, validation, and persisted study
inspection:

```bash
optuna-lightning print-config \
  --training-config examples/mnist-training.yaml \
  --optuna-config examples/mnist-optuna.yaml

optuna-lightning validate \
  --training-config examples/mnist-training.yaml \
  --optuna-config examples/mnist-optuna.yaml

optuna-lightning studies list --storage sqlite:///optuna.db
optuna-lightning studies show \
  --storage sqlite:///optuna.db \
  --study-name mnist
optuna-lightning studies trials \
  --optuna-config examples/mnist-optuna.yaml
```

The example Optuna config stores studies in `./optuna.db` relative to the
directory where the command is run, so `studies trials --optuna-config
examples/mnist-optuna.yaml` can inspect persisted trials later. The trials
table labels the value column as `Objective [val_acc, maximize]` for the MNIST
example, and storage-only inspection still shows the study direction in the
column header.
