Implementation:Mlflow Mlflow Pyproject Generator
| Knowledge Sources | |
|---|---|
| Domains | Build, Packaging |
| Last Updated | 2026-02-13 20:00 GMT |
Overview
Generates all pyproject.toml files for MLflow's package variants (dev, release, skinny, tracing) from YAML requirement specifications, serving as the single source of truth for package configurations.
Description
This script constructs and writes pyproject.toml files for four distinct MLflow package variants, each defined by the PackageType enum:
- SKINNY -- The lightweight mlflow-skinny package without SQL storage, server, UI, or data science dependencies. Written to libs/skinny/pyproject.toml with a generated README.
- TRACING -- The mlflow-tracing package containing only the minimum set of modules for instrumenting code with MLflow Tracing. Written to libs/tracing/pyproject.toml with a curated include/exclude file list (TRACING_INCLUDE_FILES / TRACING_EXCLUDE_FILES).
- RELEASE -- The full mlflow release package that depends on mlflow-skinny and mlflow-tracing at the same version, plus core requirements. Written to pyproject.release.toml.
- DEV -- The development mlflow package without sub-package dependencies (skinny and tracing requirements are included directly). Written to pyproject.toml, preserving the manual dev tool settings section below a separator.
The script reads dependencies from YAML files in the requirements/ directory using pydantic for validation via the PackageRequirement model. It validates that tracing requirements are a strict subset of skinny requirements. Each requirement spec includes pip_release name, max_major_version, optional minimum version, unsupported versions, environment markers, and extras.
Output is formatted with taplo (the TOML formatter installed by bin/install.py) and written only if content has changed to avoid unnecessary diffs. The DEV variant also runs uv lock to update the lockfile.
Usage
Run this script whenever dependencies change in the YAML requirement files, or when the package version is bumped. It requires taplo to be installed (via python bin/install.py).
Code Reference
Source Location
- Repository: Mlflow_Mlflow
- File: dev/pyproject.py
- Lines: 1-506
Signature
class PackageType(Enum):
SKINNY = "skinny"
RELEASE = "release"
DEV = "dev"
TRACING = "tracing"
def description(self) -> str: ...
class PackageRequirement(BaseModel):
pip_release: str
max_major_version: int
minimum: str | None = None
unsupported: list[str] | None = None
markers: str | None = None
extras: list[str] | None = None
freeze: bool | None = None
def generate_requirements_from_yaml(requirements_yaml: RequirementsYaml) -> list[str]: ...
def read_requirements_yaml(yaml_path: Path) -> list[str]: ...
def build(package_type: PackageType) -> None: ...
def write_toml_file_if_changed(file_path: Path, description: str, toml_data: dict[str, Any]) -> None: ...
def format_content_with_taplo(content: str) -> str: ...
def main() -> None: ...
Import
# Run from repository root (requires taplo to be installed)
python dev/pyproject.py
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| requirements/skinny-requirements.yaml | YAML file | Yes | Dependencies for the mlflow-skinny package |
| requirements/tracing-requirements.yaml | YAML file | Yes | Dependencies for the mlflow-tracing package |
| requirements/core-requirements.yaml | YAML file | Yes | Core dependencies for the full mlflow package |
| requirements/gateway-requirements.yaml | YAML file | Yes | Dependencies for the gateway optional extra |
| requirements/genai-requirements.yaml | YAML file | Yes | Dependencies for the genai optional extra |
| mlflow/version.py | Python file | Yes | Contains the VERSION string for the package |
| .python-version | Text file | Yes | Minimum Python version requirement |
| mlflow/ml-package-versions.yml | YAML file | Yes | Supported ML framework version ranges |
Outputs
| Name | Type | Description |
|---|---|---|
| pyproject.toml | TOML file | Development package configuration (preserves manual dev tool settings) |
| pyproject.release.toml | TOML file | Release package configuration with mlflow-skinny and mlflow-tracing dependencies |
| libs/skinny/pyproject.toml | TOML file | mlflow-skinny package configuration |
| libs/tracing/pyproject.toml | TOML file | mlflow-tracing package configuration |
| libs/skinny/README_SKINNY.md | Markdown file | Generated README for the skinny package |
| uv.lock | Lock file | Updated dependency lock file (for DEV variant only) |
Usage Examples
Basic Usage
# Generate all pyproject.toml variants
python dev/pyproject.py
# Ensure taplo is installed first
python bin/install.py taplo
python dev/pyproject.py