@@ -6,7 +6,9 @@ ALL_PY_SRCS := $(shell find src -name '*.py') \
66 $(shell find test -name '* .py')
77
88# Optionally overriden by the user, if they're using a virtual environment manager.
9- VENV ?= env
9+ # Warning: changing this name to something else than '.venv' will make working with
10+ # uv harder.
11+ VENV ?= .venv
1012
1113# On Windows, venv scripts/shims are under `Scripts` instead of `bin`.
1214VENV_BIN := $(VENV ) /bin
@@ -46,44 +48,37 @@ dev: $(VENV)/pyvenv.cfg
4648{%- if cookiecutter.entry_point %}
4749.PHONY : run
4850run : $(VENV ) /pyvenv.cfg
49- # Once we can specify the default VENV name in uv, use `uv run` here
50- # https://github.com/astral-sh/uv/issues/1422
51- @. $(VENV_BIN ) /activate && {{ cookiecutter.entry_point }} $(ARGS )
51+ uv run {{ cookiecutter.entry_point }} $(ARGS )
5252{%- endif %}
5353
5454$(VENV ) /pyvenv.cfg : pyproject.toml
5555 uv venv $(VENV )
56- @. $( VENV_BIN ) /activate && uv pip install -e ' .[$(INSTALL_EXTRA)]'
56+ uv pip install -e ' .[$(INSTALL_EXTRA)]'
5757
5858.PHONY : lint
5959lint : $(VENV ) /pyvenv.cfg
60- . $(VENV_BIN ) /activate && \
61- ruff format --check && \
62- ruff check && \
63- mypy
60+ uv run ruff format --check && \
61+ uv run ruff check && \
62+ uv run mypy
6463
6564 {%- if cookiecutter.docstring_coverage %}
66- . $(VENV_BIN)/activate && \
67- interrogate -c pyproject.toml .
65+ uv run interrogate -c pyproject.toml .
6866 {%- endif %}
6967
7068.PHONY : reformat
7169reformat :
72- . $(VENV_BIN ) /activate && \
73- ruff format && \
74- ruff check --fix
70+ uv run ruff format && \
71+ uv run ruff check --fix
7572
7673.PHONY : test tests
7774test tests : $(VENV ) /pyvenv.cfg
78- . $(VENV_BIN ) /activate && \
79- pytest --cov=$(PY_IMPORT ) $(T ) $(TEST_ARGS ) && \
80- python -m coverage report -m $(COV_ARGS )
75+ uv run pytest --cov=$(PY_IMPORT ) $(T ) $(TEST_ARGS )
76+ uv run coverage report -m $(COV_ARGS )
8177
8278.PHONY : doc
8379{%- if cookiecutter.documentation == 'pdoc' %}
8480doc : $(VENV ) /pyvenv.cfg
85- . $(VENV_BIN ) /activate && \
86- pdoc -o html $(PY_IMPORT )
81+ uv run pdoc -o html $(PY_IMPORT )
8782{%- elif cookiecutter.documentation == 'none' %}
8883doc :
8984 @echo " No documentation set up"
0 commit comments