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 Mlflow Versions

From Leeroopedia
Knowledge Sources
Domains Release Automation, Version Management
Last Updated 2026-02-13 20:00 GMT

Overview

A release automation script that updates the MLflow version string across all language implementations and configuration files in the repository (Python, Java, TypeScript, R, and TOML).

Description

update_mlflow_versions.py ensures version numbers stay consistent across the entire MLflow monorepo. It provides two subcommands:

  • pre-release: Sets all version files to the new release version (e.g., "2.1.0" or "2.1.0rc0") before a release is cut.
  • post-release: Bumps the patch version and appends ".dev0" (e.g., "2.1.1.dev0") after a release, preparing the master branch for ongoing development.

The script reads the current version from mlflow/version.py using regex, then applies targeted replacements across multiple file types:

  • Python files: Direct string replacement of the version in mlflow/version.py.
  • pyproject.toml files: Updates version = "..." declarations and inline dependency version pins for mlflow-skinny and mlflow-tracing.
  • TypeScript files: Updates version constants in mlflow/server/js/src/common/constants.tsx and docs/src/constants.ts.
  • Java files: Replaces version strings, converting dev/RC suffixes to -SNAPSHOT. Special handling for POM XML files to match only MLflow-specific version tags (<mlflow.version>, mlflow-spark, mlflow-parent) and avoid changing dependency versions.
  • R files: Updates the Version: field in the R package DESCRIPTION file.

The script includes validation that warns (without failing) when the new version is lower than the current version, which can happen legitimately when promoting a release candidate.

Usage

Use this script as part of the MLflow release process: run pre-release before cutting a release, and post-release on the master branch after the release is complete.

Code Reference

Source Location

Signature

def get_current_py_version() -> str: ...
def get_java_py_version_pattern(version: str) -> str: ...
def get_java_new_py_version(new_py_version: str) -> str: ...
def replace_dev_or_rc_suffix_with(version: str, repl: str) -> str: ...
def replace_occurrences(files: list[Path], pattern: str | re.Pattern[str], repl: str) -> None: ...
def replace_python(old_version: str, new_py_version: str, paths: list[Path]) -> None: ...
def replace_pyproject_toml(new_py_version: str, paths: list[Path]) -> None: ...
def replace_ts(old_version: str, new_py_version: str, paths: list[Path]) -> None: ...
def replace_java(old_version: str, new_py_version: str, paths: list[Path]) -> None: ...
def replace_java_pom_xml(old_version: str, new_py_version: str, paths: list[Path]) -> None: ...
def replace_r(old_py_version: str, new_py_version: str, paths: list[Path]) -> None: ...
def update_versions(new_py_version: str) -> None: ...
def validate_new_version(value: str) -> str: ...
def pre_release(new_version: str) -> None: ...
def post_release(new_version: str) -> None: ...

Import

# Run as a standalone script
python dev/update_mlflow_versions.py pre-release --new-version 2.19.0
python dev/update_mlflow_versions.py post-release --new-version 2.19.0

I/O Contract

Inputs

Name Type Required Description
command str Yes Subcommand: "pre-release" or "post-release"
--new-version str Yes The version to set (for pre-release) or the version that was released (for post-release)

Outputs

Name Type Description
file modifications in-place edits Updates version strings across Python, Java, TypeScript, R, and TOML files

Files Modified

Category Files
Python mlflow/version.py
pyproject.toml pyproject.toml, pyproject.release.toml, libs/skinny/pyproject.toml, libs/tracing/pyproject.toml
TypeScript mlflow/server/js/src/common/constants.tsx, docs/src/constants.ts
Java source All .java files under mlflow/java/
Java POM XML All .xml files under mlflow/java/
R mlflow/R/mlflow/DESCRIPTION

Usage Examples

Pre-Release

# Set all version files to 2.19.0 before cutting the release
python dev/update_mlflow_versions.py pre-release --new-version 2.19.0

Post-Release

# After releasing 2.19.0, bump master to 2.19.1.dev0
python dev/update_mlflow_versions.py post-release --new-version 2.19.0

Related Pages

Page Connections

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