Skip to content

Commit 7013ada

Browse files
committed
Replace all $(PYTHON) -m with $(UV) run to force local venv
* Be sure to require that UV exists so that all commands work from a fresh checkout * If `.venv` does not exist, create it when checking for UV
1 parent 02bbe65 commit 7013ada

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

Makefile

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ include vars.mk
22

33
.DEFAULT_GOAL := all
44

5-
.PHONY: build clean cov default deps dev docs ensure-uv fmt fix install it lint test uninstall version help
5+
.PHONY: build clean cov default dev docs ensure-uv _ensure-uv-cmd _ensure-uv-venv fmt fix install it lint test uninstall version help
66

77
all: dev test lint build
88

9-
build:
9+
build: ensure-uv
1010
$(UV) build
1111

1212
clean:
@@ -19,49 +19,53 @@ clean:
1919
find . -name "__pycache__" -exec rm -rf {} +
2020
find . -type d -empty -delete
2121

22-
cov:
23-
$(PYTHON) -m coverage report
22+
cov: dev
23+
$(UV) run coverage report
2424

25-
cov-html:
26-
$(PYTHON) -m coverage html
25+
cov-html: dev
26+
$(UV) run coverage html
2727
open htmlcov/index.html
2828

29-
cov-xml:
30-
$(PYTHON) -m coverage xml
29+
cov-xml: dev
30+
$(UV) run coverage xml
3131

3232
dev: ensure-uv
3333
$(UV) pip install -e '.[dev]'
3434

3535
docs:
3636
$(MAKE) -C ./docs
3737

38-
ensure-uv:
38+
$(VENV):
39+
$(UV) venv $(VENV)
40+
_ensure-uv-venv: _ensure-uv-cmd $(VENV)
41+
_ensure-uv-cmd:
3942
@if ! command -v $(UV) >/dev/null; then \
4043
$(PYTHON) -m ensurepip && $(PYTHON) -m pip install uv; \
4144
fi
45+
ensure-uv: _ensure-uv-cmd _ensure-uv-venv
4246

43-
fmt:
44-
$(PYTHON) -m ruff check --fix
45-
$(PYTHON) -m ruff format
47+
fmt: dev
48+
$(UV) run ruff check --fix
49+
$(UV) run ruff format
4650

4751
install: ensure-uv
4852
$(UV) pip install dist/*.whl
4953

5054
it:
5155
$(MAKE) -C ./integration
5256

53-
lint:
54-
$(PYTHON) -m pyright
55-
$(PYTHON) -m ruff check
57+
lint: dev
58+
$(UV) run pyright
59+
$(UV) run ruff check
5660

57-
test:
58-
$(PYTHON) -m coverage run --source=src -m pytest tests
61+
test: dev
62+
$(UV) run coverage run --source=src -m pytest tests
5963

6064
uninstall: ensure-uv
6165
$(UV) pip uninstall $(PROJECT_NAME)
6266

63-
version:
64-
@$(PYTHON) -m setuptools_scm
67+
version: dev
68+
@$(UV) run setuptools_scm
6569

6670
help:
6771
@echo "Makefile Targets"

0 commit comments

Comments
 (0)