Skip to main content

113 posts tagged with "uv"

uv, the Fast Python Package and Project Manager, Its Commands and pyproject.toml

View All Tags

How to Log SHAP Explanations with mlflow.models.evaluate

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

Metrics say how well a model does; they don't say why. SHAP values explain each prediction column by column: how much each input pushed it up or down. mlflow.models.evaluate computes them and logs three plots by itself, as soon as the shap package is installed. This guide installs it, evaluates a diabetes model and reads the plots, with real output and UI from MLflow 3.18.0.

How to Make a Python Script Exit with an Error Code

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

A script that checks something, such as tests, data or a model's scores, should tell the shell whether the check passed, so that a CI job or another script can stop when it didn't. That's what an exit code is for: 0 for success, anything else for failure. This guide makes a script exit with 1 when a check fails, and reads the code back in bash, zsh and PowerShell, with real output from Python 3.15.2.

Fixed: "SHAP or matplotlib package is not installed, so model explainability insights will not be logged" in MLflow

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

Every evaluation I ran with mlflow.models.evaluate printed WARNING mlflow.models.evaluation.evaluators.shap: SHAP or matplotlib package is not installed, so model explainability insights will not be logged. MLflow 3.18.0's default evaluator explains classifiers and regressors with SHAP, an optional package that mlflow doesn't install. There are two fixes, depending on whether you want the explanations: install shap, or turn explainability off.

How to Test an MLflow Model in a Fresh Environment with mlflow.models.predict

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A model that predicts on your computer can still fail elsewhere: a package it needs may be missing from its recorded requirements, because your own environment happened to have it. mlflow.models.predict catches that before deployment: it builds a brand-new virtual environment from the model's own requirements and predicts in it. This guide runs it with uv, with real output from MLflow 3.18.0.

MLflow Tutorial for Machine Learning in Python — Part 1: Install MLflow and Track Your First Experiment

· 42 min read
Jagdish Kumawat
Founder @ Dewiride

Every time you train a model, you change something: the number of trees, a setting, the data. A week later nobody remembers which change gave the best result. MLflow remembers it for you. In this first part you install MLflow, start your own tracking server, and log your first machine learning experiment from Python.

How to Start an MLflow Tracking Server on Your Computer

· 11 min read
Jagdish Kumawat
Founder @ Dewiride

The MLflow tracking server is the place your training runs go: a small web server that stores every run and shows them in the MLflow UI. You don't need a cloud account or a database server to run one; MLflow 3.18 brings everything, including a SQLite database. This guide starts a server on your own computer, explains every line it prints, checks that it's ready, and stops it safely.

How to Install MLflow in a Python Project with uv

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

MLflow installs like any Python package, but it brings a lot with it: a web server, a database layer and the most common data science libraries. Installing it into a uv project keeps all of that inside the project and records the exact versions. This guide installs MLflow 3.18.0, checks it, and explains which of MLflow's three packages you need.

How to Load Settings from Environment Variables and a .env File with pydantic-settings

· 10 min read
Jagdish Kumawat
Founder @ Dewiride

Hard-coding a port, a database address or a password into your code means editing the code for every computer it runs on. pydantic-settings reads those values from environment variables and a .env file instead, checks them, and gives your code typed values. This guide explains the syntax first, then builds the settings of a small demo app and shows, with real output, which source wins and what happens when a value is wrong.

How to Check the Installed Version of a Python Package with uv

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

Before you follow a guide, report a bug or upgrade, you need to know exactly which version of a package your project runs. In a uv project the answer is in the project's own environment, not in your computer's Python. This guide gives the syntax of four ways to read it first, then uses each one on a small hello-world project, with real output from uv 0.13.9.