1- export POETRY_HOME =$(CURDIR ) /.poetry
2- # https://github.com/python-poetry/poetry/issues/1917
3- export PYTHON_KEYRING_BACKEND =keyring.backends.null.Keyring
1+ UV_SYSTEM: =$(shell command -v uv 2>/dev/null)
2+ UV_BIN: =$(if $(UV_SYSTEM ) ,$(UV_SYSTEM ) ,$(CURDIR ) /.uv/uv)
3+ UV_VENV: =$(CURDIR ) /.venv
4+ UV_DEPS: =$(UV_VENV ) /.deps
45
5- POETRY: =$(POETRY_HOME ) /bin/poetry
6- POETRY_DEPS: =$(POETRY_HOME ) /.deps
7- SYS_PYTHON: =$(shell command -v python3 || command -v python || echo .no-python-found)
86default : test
97
108help : # with thanks to Ben Rady
119 @grep -E ' ^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
1210
13- $(SYS_PYTHON ) :
14- @echo Could not find a system python
15- exit 1
11+ $(CURDIR ) /.uv/uv :
12+ @echo " Installing uv..."
13+ @mkdir -p $(dir $@ )
14+ @curl -LsSf https://astral.sh/uv/install.sh | UV_NO_MODIFY_PATH=1 UV_INSTALL_DIR=$(CURDIR ) /.uv sh -s
1615
1716.PHONY : deps
18- deps : $(POETRY ) $(POETRY_DEPS )
19- $(POETRY ) : $(SYS_PYTHON )
20- curl -sSL https://install.python-poetry.org | $(SYS_PYTHON ) - --version 1.8.5
21- $(POETRY_DEPS ) : $(POETRY ) pyproject.toml poetry.lock
22- $(POETRY ) install
17+ deps : $(UV_BIN ) $(UV_DEPS )
18+ $(UV_DEPS ) : $(UV_BIN ) pyproject.toml
19+ $(UV_BIN ) sync --no-install-project
2320 @touch $@
2421
2522.PHONY : pre-commit
2623pre-commit : deps # # Runs all pre-commit hooks
27- $(POETRY ) run pre-commit run --all-files
24+ $(UV_BIN ) run pre-commit run --all-files
2825
2926.PHONY : install-pre-commit
3027install-pre-commit : deps # # Install pre-commit hooks
31- $(POETRY ) run pre-commit install
28+ $(UV_BIN ) run pre-commit install
3229
3330.PHONY : test
3431test : deps # # Runs tests
@@ -37,4 +34,4 @@ test: deps ## Runs tests
3734
3835.PHONY : build-yamls
3936build-yamls : deps # # Builds all the yaml build files
40- $(POETRY ) run python make_builds.py
37+ $(UV_BIN ) run python make_builds.py
0 commit comments