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.

Principle:Mlflow Mlflow Version Detection and Package Identity

From Leeroopedia
Knowledge Sources
Domains Package Management, Version Control, Runtime Detection
Last Updated 2026-02-13 20:00 GMT

Overview

A version declaration and package identity detection module that determines the installed distribution variant at import time, enabling conditional behavior based on available capabilities.

Description

Version detection and package identity serves two distinct purposes within the platform:

Version declaration defines the current version string as a module-level constant. A helper function determines whether the declared version represents a formal release or a development build by testing whether the version string matches a strict numeric pattern (three dot-separated integers with no suffix). This distinction is used by build tooling, documentation generation, and compatibility checks throughout the platform.

Package identity detection probes the installed Python environment at import time to determine which distribution variant is present. The platform can be installed in three configurations, each providing a different level of functionality:

  1. Full package: The complete distribution with all dependencies, providing the full feature set including tracking, model management, serving, and all integrations.
  2. Skinny package: A lightweight distribution that includes core tracking and model management functionality but omits heavy dependencies such as web frameworks, database drivers, and ML framework integrations.
  3. Tracing SDK only: The minimal distribution containing only the instrumentation and tracing capabilities, with no tracking server, model management, or experiment features.

Detection works by querying the package metadata registry for each known distribution name. Three boolean flags are computed at module load time:

  • IS_TRACING_SDK_ONLY: True when neither the full nor the skinny package is installed, indicating only the tracing SDK is available.
  • IS_MLFLOW_SKINNY: True when the skinny package is installed but the full package is not.
  • IS_FULL_MLFLOW: True when the full package is installed.

These flags are consumed throughout the codebase to conditionally import modules, enable or disable features, and provide informative error messages when a user attempts to access functionality that is not available in their installed variant.

Usage

This principle applies when:

  • The platform must support multiple distribution variants with different dependency footprints.
  • Modules need to conditionally import heavy dependencies that may not be installed.
  • Build and release tooling needs to distinguish between development and release versions.
  • Error messages must guide users to install the correct package variant for their use case.
  • Feature gates must be evaluated at import time to avoid runtime import failures.

Theoretical Basis

The version and identity detection follows an import-time environment probe pattern:

VERSION CLASSIFICATION:
  version_string = "X.Y.Z" or "X.Y.Z.devN" or "X.Y.ZrcN"
  is_release = regex_match("^\d+\.\d+\.\d+$", version_string)

PACKAGE IDENTITY DETECTION:
  function is_installed(package_name):
    try:
      query_package_metadata(package_name)
      return True
    except PackageNotFound:
      return False

  full_installed     = is_installed("full-package")
  skinny_installed   = is_installed("skinny-package")

  IS_TRACING_SDK_ONLY = NOT full_installed AND NOT skinny_installed
  IS_SKINNY           = skinny_installed AND NOT full_installed
  IS_FULL             = full_installed

CONDITIONAL IMPORT PATTERN (consumer):
  if IS_TRACING_SDK_ONLY:
    # Skip importing modules that require full dependencies
  elif IS_SKINNY:
    # Import core modules but skip heavy integrations
  else:
    # Import everything

The key design principles are:

  • Fail-safe probing: Package detection uses exception handling rather than filesystem inspection, making it robust against virtual environments, editable installs, and non-standard package layouts.
  • Eager evaluation: The flags are computed once at module load time and stored as module-level constants, avoiding repeated metadata queries on every access.
  • Mutual exclusivity: The three identity flags partition the space of possible installations. Exactly one of the three states (tracing-only, skinny, or full) is true at any given time.
  • Semantic versioning compliance: The release detection regex enforces strict three-component numeric versioning, treating any suffix (dev, rc, alpha, beta) as a non-release indicator.

Related Pages

Page Connections

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