diff --git a/.readthedocs.yml b/.readthedocs.yml index 5d8884584..26e5be967 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,5 +14,8 @@ build: python: "3" commands: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest - make dirhtml BUILDDIR=_readthedocs - mv _readthedocs/dirhtml _readthedocs/html diff --git a/Makefile b/Makefile index 76f5b9df5..985e46e82 100644 --- a/Makefile +++ b/Makefile @@ -70,9 +70,14 @@ venv: ensure-venv: @if [ ! -d $(VENVDIR) ] ; then \ echo "Creating venv in $(VENVDIR)"; \ - $(PYTHON) -m venv $(VENVDIR); \ - $(VENVDIR)/bin/python3 -m pip install --upgrade pip; \ - $(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \ + if uv --version > /dev/null; then \ + uv venv $(VENVDIR); \ + VIRTUAL_ENV=$(VENVDIR) uv pip install -r requirements.txt; \ + else \ + $(PYTHON) -m venv $(VENVDIR); \ + $(VENVDIR)/bin/python3 -m pip install --upgrade pip; \ + $(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \ + fi; \ echo "The venv has been created in the $(VENVDIR) directory"; \ fi @@ -175,7 +180,11 @@ check: ensure-venv .PHONY: lint lint: venv - $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit + if uv --version > /dev/null; then \ + $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install pre-commit; \ + else \ + $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit; \ + fi; $(VENVDIR)/bin/python3 -m pre_commit run --all-files .PHONY: serve