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
pip install yab-ml
Quick Start
Return a template handle
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
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().
handle = yab.use("tabular_classifier", type="full")
trainer = handle.get_trainer()
trainer.fit()
Partial
Returns (model, handle).
model, handle = yab.use("tabular_classifier", type="partial")
trainer = handle.get_trainer()
trainer.fit()
Raw
Returns only the generated model.
model = yab.use("tabular_classifier", type="raw")
CLI
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
Metadata
Release files for yab-ml 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yab_ml-0.1.1.tar.gz | 48.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yab_ml-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.8 kB
Release files / yab_ml-0.1.1.tar.gz
| Download URL | yab_ml-0.1.1.tar.gz |
|---|---|
| Size | 48.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cffd3c067c3da89538b63fd0eea1f4e80684093b17515b3d71d62fb670e7a18
|
|
BLAKE2b-256 checksum How to use checksums |
46e9c6aa542a86ccd9e08ea195c702e3f42738c3c6849e6ed37d9b2e4c194c82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / yab_ml-0.1.1-py3-none-any.whl
| Download URL | yab_ml-0.1.1-py3-none-any.whl |
|---|---|
| Size | 78.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7cd223e4af84dfeb86b89881a91f710dca5f8b33f8e7bde9eea427f8134c2f9
|
|
BLAKE2b-256 checksum How to use checksums |
ee18b9aaa0f3b9856c5a2e244e87a09830d2f5c2cf56a961945a764d5eab0666
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|