Skip to content

Instantly share code, notes, and snippets.

@marcelohmariano
Last active September 25, 2025 14:12
Show Gist options
  • Select an option

  • Save marcelohmariano/b3bdfe6ffb01486b18d1f20b37cf9c0b to your computer and use it in GitHub Desktop.

Select an option

Save marcelohmariano/b3bdfe6ffb01486b18d1f20b37cf9c0b to your computer and use it in GitHub Desktop.
Python Makefile for UV
SHELL := /bin/sh
MAKEFLAGS += -Rrs
.ONESHELL:
.SUFFIXES:
python := $(shell which python3)
args = $(filter-out $@,$(MAKECMDGOALS))
uv := .uv/bin/uv
ruff := $(uv) run ruff
pytest := $(uv) run pytest
pyright := $(uv) run pyright
.PHONY: format lint typecheck test uv
format: $(uv)
$(ruff) format
lint: $(uv)
$(ruff) check
typecheck: $(uv)
$(pyright)
test: $(uv)
$(pytest)
uv: $(uv)
$(uv) $(args)
$(uv):
rm -rf .uv && $(python) -m venv .uv && .uv/bin/pip install uv
%:;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment