Implementation:Mlflow Mlflow Version Module
| Knowledge Sources | |
|---|---|
| Domains | Version Management, Core Infrastructure |
| Last Updated | 2026-02-13 20:00 GMT |
Overview
Defines the canonical MLflow version string and package variant detection flags that control import behavior across the MLflow ecosystem.
Description
mlflow/version.py is the central version definition for the MLflow project. It serves two primary purposes:
Version String: The VERSION constant (currently "3.10.1.dev0") is the single source of truth for the MLflow package version. The is_release_version() function checks whether the current VERSION matches the release format (X.Y.Z with no suffix), returning False for development (.dev0) and release candidate (rcN) versions. This version string is read and updated by the dev/update_mlflow_versions.py script during the release process.
Package Variant Detection: The module uses importlib.metadata to detect which MLflow package variant is installed in the current environment:
- IS_TRACING_SDK_ONLY: Set to True when neither mlflow nor mlflow-skinny is installed, indicating only the tracing SDK (
mlflow-tracing) is available. When True, modules that depend on dependencies not included in the tracing SDK are not imported. - IS_MLFLOW_SKINNY: Set to True when mlflow-skinny is installed but the full mlflow package is not. The skinny package excludes heavy dependencies like SQL libraries and ML framework integrations.
- IS_FULL_MLFLOW: Set to True when the full mlflow package is installed.
The helper function _is_package_installed() uses importlib.metadata.version() to check package availability, catching PackageNotFoundError for packages that are not installed.
Usage
This module is imported by mlflow/__init__.py to control conditional imports based on the installed package variant. Other modules reference VERSION for version reporting, API headers, and compatibility checks.
Code Reference
Source Location
- Repository: Mlflow_Mlflow
- File: mlflow/version.py
- Lines: 1-29
Signature
VERSION = "3.10.1.dev0"
def is_release_version() -> bool: ...
def _is_package_installed(package_name: str) -> bool: ...
IS_TRACING_SDK_ONLY: bool
IS_MLFLOW_SKINNY: bool
IS_FULL_MLFLOW: bool
Import
from mlflow.version import VERSION
from mlflow.version import IS_TRACING_SDK_ONLY, IS_MLFLOW_SKINNY, IS_FULL_MLFLOW
from mlflow.version import is_release_version
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | - | - | This module requires no inputs; it reads version from its own source and checks installed packages via importlib.metadata |
Outputs
| Name | Type | Description |
|---|---|---|
| VERSION | str | The current MLflow version string (e.g., "3.10.1.dev0") |
| is_release_version() | bool | True if VERSION matches the release format (X.Y.Z with no suffix) |
| IS_TRACING_SDK_ONLY | bool | True if only mlflow-tracing is installed (no mlflow or mlflow-skinny) |
| IS_MLFLOW_SKINNY | bool | True if mlflow-skinny is installed but not the full mlflow package |
| IS_FULL_MLFLOW | bool | True if the full mlflow package is installed |
Package Variant Detection Logic
| Installed Package | IS_FULL_MLFLOW | IS_MLFLOW_SKINNY | IS_TRACING_SDK_ONLY |
|---|---|---|---|
| mlflow | True | False | False |
| mlflow-skinny | False | True | False |
| mlflow-tracing only | False | False | True |
Usage Examples
Check Version
from mlflow.version import VERSION, is_release_version
print(f"MLflow version: {VERSION}")
if is_release_version():
print("This is a release version")
else:
print("This is a development or RC version")
Conditional Import Based on Package Variant
from mlflow.version import IS_TRACING_SDK_ONLY
if not IS_TRACING_SDK_ONLY:
# Import modules that require full MLflow or skinny dependencies
from mlflow.tracking import MlflowClient