Metadata-Version: 2.4
Name: yab_ml
Version: 0.1.0
Summary: Yet Another Boilerplate — generate and inject PyTorch training code from templates.
Author-email: Rohan Pattanayak <rohan@example.com>, "Soumya <Last Name>" <soumya@example.com>
License: MIT
Project-URL: Homepage, https://github.com/RohanOnKeys/yab
Project-URL: Repository, https://github.com/RohanOnKeys/yab
Project-URL: Issues, https://github.com/RohanOnKeys/yab/issues
Keywords: pytorch,boilerplate,code-generation,machine-learning,training
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jinja2<4,>=3.1
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: black<26,>=24.0
Requires-Dist: ruff<1,>=0.5
Requires-Dist: nbformat<6,>=5.9
Requires-Dist: ipython<9,>=8.0
Requires-Dist: torch<3,>=2.2
Requires-Dist: tqdm<5,>=4.66
Requires-Dist: tensorboard<3,>=2.16
Requires-Dist: numpy<3,>=1.26
Requires-Dist: pandas<3,>=2.0
Requires-Dist: scikit-learn<2,>=1.4
Requires-Dist: torchvision<1,>=0.17
Requires-Dist: pillow<12,>=10.0
Requires-Dist: transformers<6,>=4.40
Requires-Dist: datasets<4,>=2.18
Provides-Extra: dev
Requires-Dist: pytest<9,>=8.0; extra == "dev"
Requires-Dist: pytest-cov<6,>=5.0; extra == "dev"
Dynamic: license-file

# YAB

[![License:
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/)
[![GitHub
stars](https://img.shields.io/github/stars/RohanOnKeys/yab?style=social)](https://github.com/RohanOnKeys/yab)
[![GitHub
forks](https://img.shields.io/github/forks/RohanOnKeys/yab?style=social)](https://github.com/RohanOnKeys/yab)

Yet Another Boilerplate

YAB is a Python library that removes repetitive PyTorch boilerplate
without taking away control.

It provides two primary workflows:

-   `yab.use()` renders a template in memory and returns a handle to the
    generated implementation.
-   `yab.write()` injects clean, editable PyTorch code directly into
    your Python script or Jupyter notebook.

Unlike frameworks that hide everything behind custom APIs, YAB generates
real code that belongs to you.

------------------------------------------------------------------------

# Features

-   Zero-boilerplate PyTorch workflows
-   Editable generated source code
-   Three abstraction levels
-   Python API and CLI
-   AST-based code injection
-   Jupyter notebook support
-   Lazy dataset loading
-   Built-in fallback datasets
-   Automatic formatting with Black and Ruff
-   Versioned templates
-   Extensible template registry
-   Idempotent code generation

------------------------------------------------------------------------

# Installation

``` bash
pip install yab
```

------------------------------------------------------------------------

# Quick Start

## Return a template handle

``` python
import yab

handle = yab.use(
    "tabular_classifier",
    type="full",
    input_features=4,
    num_classes=3,
)

trainer = handle.get_trainer()
trainer.fit()
```

Nothing is written to disk.

------------------------------------------------------------------------

## Generate boilerplate

``` python
import yab

yab.write(
    "tabular_classifier",
    type="full",
    input_features=4,
    num_classes=3,
)
```

Repeated calls update the previously generated YAB block instead of
creating duplicates.

------------------------------------------------------------------------

# Lazy Dataset Loading

Generated templates do not construct datasets during import.

`yab.use()` renders the template, `handle.get_trainer()` constructs the
trainer, and `trainer.fit()` loads either your own dataset via
`data_path` or a built-in fallback dataset.

Supported built-in datasets include:

-   Iris
-   Wine
-   MNIST
-   CIFAR-10
-   AG News
-   IMDB

------------------------------------------------------------------------

# Abstraction Levels

## Full

Returns a TemplateHandle exposing `get_trainer()`.

``` python
handle = yab.use("tabular_classifier", type="full")
trainer = handle.get_trainer()
trainer.fit()
```

## Partial

Returns `(model, handle)`.

``` python
model, handle = yab.use("tabular_classifier", type="partial")
trainer = handle.get_trainer()
trainer.fit()
```

## Raw

Returns only the generated model.

``` python
model = yab.use("tabular_classifier", type="raw")
```

------------------------------------------------------------------------

# CLI

``` bash
yab list
yab types
yab use tabular_classifier --type full
yab write tabular_classifier --type partial
yab version
```

------------------------------------------------------------------------

# Templates

Implemented

-   Tabular Classifier
-   Image Classifier
-   Text Classifier

Planned

-   Autoencoder
-   GAN
-   Transformer Fine-Tuning

------------------------------------------------------------------------

# Testing

Coverage includes:

-   Template rendering
-   AST injection
-   Notebook injection
-   Duplicate detection
-   Formatting
-   End-to-end model training
-   CLI behavior
-   Built-in fallback datasets

------------------------------------------------------------------------

# Continuous Integration

Every push runs:

-   Ruff
-   Black
-   Pytest

Tagged releases can be published to PyPI.

------------------------------------------------------------------------

# Philosophy

Most libraries replace boilerplate with another abstraction.

YAB replaces boilerplate with your own code.

You keep complete ownership of what is generated while avoiding hours of
repetitive setup.

------------------------------------------------------------------------

# License

MIT
