.gemini/skills/MLOps Industrialization/SKILL.md
Guide to transform prototypes into robust, distributable Python packages using the src layout, hybrid paradigm, and strict configuration management.
npx skillsauth add fmind/mlops-python-package MLOps IndustrializationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
To convert experimental code (notebooks/scripts) into a high-quality, distributable Python package. This skill enforces the src/ layout, a Hybrid Paradigm (OOP structure + Functional purity), and Strict Configuration to ensure scalability, security, and maintainability.
uvnotebooks/ to src/.src Layout)Adopt the src layout to prevent import errors and separate source from tooling.
Directory Tree:
my-project/
├── pyproject.toml # Dependencies & Metadata
├── uv.lock
├── README.md
└── src/
└── my_package/ # Main package directory
├── __init__.py
├── io/ # Side-effects (Datasets, APIs)
├── domain/ # Pure business logic (Models, Features)
└── application/ # Orchestration (Training loops, Inference)
Configuration: Use pyproject.toml for all build metadata and dependencies.
Balance structure with predictability.
Create standard, installable CLI tools.
Define Script: Create src/my_package/scripts.py with a main() function.
Register: Add to pyproject.toml:
[project.scripts]
my-tool = "my_package.scripts:main"
CLI Execution:
uv run my-tool (No install needed).pip install . -> my-tool (Installed on PATH).Guard: Always use if __name__ == "__main__": in scripts to prevent execution on import.
Decouple settings from code using OmegaConf (Parsing) and Pydantic (Validation).
Define Schema (Pydantic):
from pydantic import BaseModel
class TrainingConfig(BaseModel):
batch_size: int = 32
learning_rate: float = 0.001
use_gpu: bool = False
Parse & Validate (OmegaConf):
import omegaconf
# 1. Load YAML
conf = omegaconf.OmegaConf.load("config.yaml")
# 2. Merge with CLI (optional)
cli_conf = omegaconf.OmegaConf.from_cli()
merged = omegaconf.OmegaConf.merge(conf, cli_conf)
# 3. Validate -> Returns a validated Pydantic object
cfg: TrainingConfig = TrainingConfig(**omegaconf.OmegaConf.to_container(merged))
Secrets: Use Environment Variables (os.getenv), never commit them.
Make code usable and maintainable.
Docstrings: Use Google Style docstrings for all modules, classes, and functions.
def calculate_metric(y_true: np.ndarray, y_pred: np.ndarray) -> float:
"""Calculates the accuracy score.
Args:
y_true: Ground truth labels.
y_pred: Predicted labels.
Returns:
The accuracy as a float between 0 and 1.
"""
Type Hints: Use standard python typing (typing, list[str]) everywhere.
Pydantic + OmegaConf pattern.[project.scripts]) as the public interface for your automation tools.import my_package run any code? (It shouldn't).src/?pyproject.toml and YAML?pyproject.toml?development
Guide to implement rigorous validation layers including static analysis, automated testing, structured logging, and security scanning.
testing
Guide to create structured, reproducible Jupyter notebooks for MLOps prototyping, emphasizing configuration management and pipeline integrity.
testing
Guide to implement full stack observability including reproducibility, lineage, monitoring, alerting, and explainability.
tools
Guide to initialize a new MLOps project with standard tools (uv, git, VS Code) and best practices.