Skip to main content
mlplant-bg
mlplant is an MLOps framework that converts exploratory Jupyter notebooks into production-ready FastAPI projects using in-cell annotations.

Installation

pip install mlplant-cli

How to use

1. Annotate your notebook

Place an annotation at the top of each cell to mark it as a pipeline step. Four syntax styles are supported — pick whichever fits your workflow:

Valid before any code, reads like a registration call, no errors or warnings:

import mlplant

mlplant.config()
LEARNING_RATE = 0.01
N_ESTIMATORS = 100
mlplant.features()
X["new_feature"] = X["a"] / X["b"]

Decorator

Clean decorator syntax, but only valid immediately before a def or class:

@mlplant.train
def _():
    model.fit(X_train, y_train)
@mlplant.predict
def predict(data: dict):
    return model.predict([list(data.values())])[0]

Expression

Minimal form — attribute access with no call. Valid anywhere, but Pylance may show an "expression value is unused" hint in some configurations:

mlplant.load_data
df = pd.read_csv("data/train.csv")

Comment

Never causes any error or warning, useful when you want zero runtime footprint:

# @mlplant.preprocessing
df = df.dropna()
df["age"] = df["age"].clip(0, 120)

All styles also accept PascalCase aliases (Config, LoadData, Train, etc.):

mlplant.LoadData()        # same as mlplant.load_data()
# @Config                 # same as # @mlplant.config
@mlplant.Train            # same as @mlplant.train (before a function)

Cells with the same annotation are automatically merged into a single output file. Visual noise (matplotlib, seaborn, print, display) is stripped automatically.

2. Build the project

# as a direct command (after installation)
mlplant build my_notebook.ipynb --output ./api --port 8080 --title "My API" --docker

# or via python -m (works anywhere)
python -m mlplant build my_notebook.ipynb --output ./api --docker

By default, build now also runs train_pipeline.py in the generated project, so the API starts with ready-to-serve artifacts in artifacts/.

Data files can stay at the project root (for example data/train.csv). During auto-training, mlplant keeps reading data from the notebook/project root, but all generated pipeline outputs are written under the selected output folder.

With --mlflow, if a remote tracking server is unavailable, mlplant automatically falls back to local SQLite tracking (no server required), stored in output/artifacts/mlflow.db.

To generate files only (without training), use:

mlplant build my_notebook.ipynb --output ./api --no-train

3. Inspect detected steps

mlplant inspect my_notebook.ipynb

# or
python -m mlplant inspect my_notebook.ipynb

Supported annotations

Annotation PascalCase alias Generated file Purpose
mlplant.config() mlplant.Config() src/config.py Hyperparameters and constants
mlplant.load_data() mlplant.LoadData() src/data_loader.py Data ingestion
mlplant.preprocessing() mlplant.Preprocessing() src/preprocessing.py Cleaning and null handling
mlplant.features() mlplant.Features() src/features.py Feature engineering
mlplant.train() mlplant.Train() src/trainer.py Model training
mlplant.evaluate() mlplant.Evaluate() src/evaluate.py Metrics and evaluation
mlplant.artifacts() mlplant.Artifacts() src/artifacts.py Model serialization
mlplant.predict() mlplant.Predict() src/predict.py Inference (exposed at /predict)

Build flags

mlplant build <notebook> [OPTIONS]

  --output / -o   Output directory             (default: ./output)
  --port          Server port                  (default: 8000)
  --title         Swagger UI title             (default: "mlplant API")
  --workers       Uvicorn workers              (default: 1)
  --docker        Generate optimized Dockerfile
  --mlflow        Inject MLflow tracking into training
  --train         Run generated train pipeline after build (default)
  --no-train      Skip training during build

Output layout after build

Generated code is placed in the output folder (./output by default):

  • output/main.py
  • output/src/*
  • output/train_pipeline.py
  • output/requirements.txt
  • output/Dockerfile (when --docker is enabled)

Pipeline runtime artifacts are also kept in the output folder:

  • output/artifacts/models/*.joblib
  • output/artifacts/metadata.json
  • output/artifacts/label_encoder.joblib (when available)
  • output/artifacts/mlflow.db (local MLflow SQLite tracking)
  • output/artifacts/catboost_info/ (CatBoost auxiliary outputs)

Metadata

Release files for mlplant-cli 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlplant-cli 0.1.3
File Size Uploaded Provenance Actions
mlplant_cli-0.1.3.tar.gz 25.5 kB Without provenance Details for mlplant_cli-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mlplant-cli 0.1.3
File Interpreter ABI Platform Actions
mlplant_cli-0.1.3-py3-none-any.whl Python 3 none any Details for mlplant_cli-0.1.3-py3-none-any.whl

Total release size: 56.4 kB

Release files / mlplant_cli-0.1.3.tar.gz

Download URL mlplant_cli-0.1.3.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8a96fcc37c053dcbc99c42f0e3ae05258f9293ea8258c3e7b5e8e409878b73b3
BLAKE2b-256 checksum
How to use checksums
7537f742ce4e5279f9f6fc1777a6b915fefc4a9f742eede062a8ae9b8517d1cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / mlplant_cli-0.1.3-py3-none-any.whl

Download URL mlplant_cli-0.1.3-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55d4663606a866f1a693c28d2f0387425dcb4e86afa281ec8eed841c7dfcf2b9
BLAKE2b-256 checksum
How to use checksums
8bcf2ed425b10e33ae67ce262464c8ad7f9d915dac43c51f442d7ebf32050d16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for mlplant-cli 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page