From 1f1f377efb5d26f27fd31a9442f209ee56dd3e5d Mon Sep 17 00:00:00 2001 From: Raphael Boidol Date: Tue, 15 Oct 2024 20:43:26 +0200 Subject: [PATCH] build: switch Makefile to `uv` Consistent venv & tool handling --- Makefile | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index b99eed8..66573e3 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,15 @@ .DEFAULT_GOAL := all -# venv handling: https://github.com/sio/Makefile.venv/blob/master/Makefile.venv -VENVDIR=.venv -MARKER=.initialized-with-Makefile.venv -VENV=$(VENVDIR)/bin - - -$(VENV): - python3 -m venv $(VENVDIR) - $(VENV)/python3 -m pip install --upgrade pip setuptools wheel - - -$(VENV)/$(MARKER): $(VENV) - - -## venv : Initialize virtual environment with dependencies. -.PHONY: venv -venv: $(VENV)/$(MARKER) - $(VENV)/pip install -q .[tests,svg,avif] - - .PHONY: all all: format check test version +.PHONY: sync +sync: + @uv sync --all-extras + + .PHONY: help help: Makefile @sed -n 's/^##//p' $< | sort @@ -32,26 +17,26 @@ help: Makefile ## upgrade : Update pre-commit configuration. .PHONY: upgrade -upgrade: venv - $(VENV)/pre-commit autoupdate +upgrade: sync + uv run pre-commit autoupdate ## check : Execute pre-commit hooks. .PHONY: check -check: venv - $(VENV)/pre-commit run --all-files +check: sync + uv run pre-commit run --all-files ## format : Format code. .PHONY: format -format: venv - $(VENV)/ruff format -q . +format: sync + uv run ruff format -q . ## test : Execute tests. .PHONY: test -test: venv - $(VENV)/pytest -q +test: sync + uv run pytest -q ## version : Show which version is detected @@ -95,9 +80,3 @@ release-minor: release .PHONY: release-major release-major: NEXT_VERSION:=$$((${MAJOR}+1)).0.0 release-major: release - - -## clean : Remove virtual environment. -.PHONY: clean -clean: - rm -r "$(VENVDIR)"