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 Dev Environment Setup

From Leeroopedia
Knowledge Sources
Domains DevTools, Setup
Last Updated 2026-02-13 20:00 GMT

Overview

Comprehensive shell script that sets up a complete MLflow development environment including pyenv, Python, virtualenv, dependencies, pre-commit hooks, and optional tools.

Description

This script automates the full developer onboarding process for the MLflow project. It proceeds through numbered stages with resume capability via a progress file, so if the script is interrupted it can be restarted from where it left off.

Mandatory steps (executed with strict error handling):

  1. Install pyenv -- Detects the OS (macOS or Linux), installs prerequisites, and installs pyenv either via Homebrew (macOS) or from source (Linux).
  2. Install minimum Python version -- Determines the minimum supported Python version (3.10), installs it via pyenv, and configures pip and virtualenv.
  3. Create virtualenv -- Creates a virtual environment at the specified directory (default: <REPO_ROOT>/.venvs/mlflow-dev). Prompts for replacement if one already exists.
  4. Install MLflow and dependencies -- Installs MLflow in editable mode with extras, plus either full dev requirements (-f flag) or the standard test, lint, and doc requirements.
  5. Configure pre-commit and git sign-off -- Sets up pre-commit hooks and optionally configures git user.name and user.email for commit signing.

Optional steps (executed without strict error handling):

  • Install pandoc (version 2.2.1+) for documentation compilation.
  • Check for Docker installation.

The script supports several command-line flags for customization and includes a version_gt utility function for comparing version numbers.

Usage

Run this script once when setting up a new MLflow development environment. Use the -f flag for a full development setup with all flavor dependencies, or omit it for a lighter environment.

Code Reference

Source Location

Signature

# Key functions defined in the script:
showHelp()                          # Display usage information
load_progress()                     # Load progress from checkpoint file
save_progress()                     # Save current step to checkpoint file
check_and_install_brew()            # Install Homebrew on macOS if missing
version_gt()                        # Compare two version numbers
check_and_install_pyenv()           # Install pyenv if not present
check_and_install_min_py_version()  # Install minimum required Python version
create_virtualenv()                 # Create or replace the virtual environment
install_mlflow_and_dependencies()   # Install MLflow and pip dependencies
set_pre_commit_and_git_signoff()    # Configure pre-commit hooks and git identity
check_and_install_pandoc()          # Optionally install pandoc
check_docker()                      # Check for Docker installation

Import

# Run from the repository root
dev/dev-env-setup.sh

# Specify a custom virtualenv directory
dev/dev-env-setup.sh -d /path/to/.venvs/mlflow-dev

# Full development environment with all flavor dependencies
dev/dev-env-setup.sh -f

# Override Python version
dev/dev-env-setup.sh -o 3.11

# Clean restart (discard previous progress)
dev/dev-env-setup.sh -c

I/O Contract

Inputs

Name Type Required Description
-d / --directory path No Path to install the virtual environment (default: <REPO_ROOT>/.venvs/mlflow-dev)
-f / --full flag No Install all dev requirements including all ML flavor dependencies
-q / --quiet flag No Run pip install in quiet mode
-o / --override version string No Override the Python version to install (e.g., "3.11" or "3.11.5")
-c / --clean flag No Discard previous installation progress and restart from scratch

Outputs

Name Type Description
Virtual environment Directory Fully configured Python virtual environment with MLflow and dependencies
Progress file File Checkpoint file at <REPO_ROOT>/dev-env-setup-progress for resume capability
Pre-commit hooks Configuration Installed git pre-commit hooks

Usage Examples

Basic Usage

# Standard development environment setup
dev/dev-env-setup.sh -d $(pwd)/.venvs/mlflow-dev

# Full setup with all flavor dependencies
dev/dev-env-setup.sh -d $(pwd)/.venvs/mlflow-dev -f

# Quiet mode for CI environments
dev/dev-env-setup.sh -q

# Activate the environment after setup
source .venvs/mlflow-dev/bin/activate

Related Pages

Page Connections

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