Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Mlflow Mlflow Update ML Package Versions

From Leeroopedia
Knowledge Sources
Domains CI/CD, Package Management, Build Infrastructure
Last Updated 2026-02-13 20:00 GMT

Overview

Updates the maximum (and minimum) package versions in mlflow/ml-package-versions.yml to the latest available on PyPI and regenerates the derived Python module.

Description

update_ml_package_versions.py is a maintenance script that keeps MLflow's cross-version test matrix current with the latest releases of supported ML frameworks. It performs two main operations:

YAML Update: For each flavor defined in ml-package-versions.yml, the script fetches version information from the PyPI JSON API using urllib.request. It filters out pre-release, dev, recently uploaded (less than 1 day old), and yanked versions. It then updates the maximum field to the latest available version using regex-based text replacement (preserving YAML formatting). It also updates the minimum field based on a time-based support policy: non-GenAI packages are supported for 2 years, while GenAI packages are supported for 1 year.

Python Module Generation: After updating the YAML, the script regenerates mlflow/ml_package_versions.py, which contains a Python dictionary representation of the configuration. This includes _ML_PACKAGE_VERSIONS (full config), GENAI_FLAVOR_TO_MODULE_NAME (GenAI autologging module map), and NON_GENAI_FLAVOR_TO_MODULE_NAME (non-GenAI autologging module map).

The VersionInfo dataclass tracks both the version string and upload time for each release, enabling the time-based minimum version policy. Certain flavors like litellm are explicitly skipped from automatic updates.

Usage

Run this script periodically (or in CI) to keep the ML package version configuration up-to-date with the latest PyPI releases.

Code Reference

Source Location

Signature

@dataclass
class VersionInfo:
    version: str
    upload_time: datetime

def get_package_version_infos(package_name: str) -> list[VersionInfo]: ...
def get_latest_version(candidates) -> str: ...
def update_version(src, key, new_version, category, update_max) -> str: ...
def get_min_supported_version(versions_infos: list[VersionInfo], genai: bool = False) -> str | None: ...
def update_ml_package_versions_py(config_path): ...
def update(skip_yml=False): ...
def main(): ...

Import

# Run directly as a script from the repository root
python dev/update_ml_package_versions.py

# Skip YAML update, only regenerate the Python module
python dev/update_ml_package_versions.py --skip-yml

I/O Contract

Inputs

Name Type Required Description
--skip-yml flag No Skip updating ml-package-versions.yml and only regenerate the Python module
mlflow/ml-package-versions.yml YAML file Yes Source configuration file listing all ML frameworks and version ranges

Outputs

Name Type Description
mlflow/ml-package-versions.yml YAML file Updated configuration with latest maximum and minimum versions
mlflow/ml_package_versions.py Python file Auto-generated Python module with _ML_PACKAGE_VERSIONS dict and flavor-to-module mappings

Usage Examples

Basic Usage

# Prerequisites
pip install packaging pyyaml

# Update both YAML and Python module (run from repository root)
python dev/update_ml_package_versions.py

# Only regenerate the Python module from existing YAML
python dev/update_ml_package_versions.py --skip-yml

Programmatic Usage

from dev.update_ml_package_versions import get_package_version_infos, get_latest_version

# Get all released versions of scikit-learn
versions = get_package_version_infos("scikit-learn")

# Find the latest version
latest = get_latest_version([v.version for v in versions])

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment