@@ -2,30 +2,9 @@ SHELL := /bin/bash
22
33PY_IMPORT = {{ cookiecutter.__project_import }}
44
5- ALL_PY_SRCS := $(shell find src -name '* .py') \
6- $(shell find test -name '* .py')
7-
8- # Optionally overriden by the user, if they're using a virtual environment manager.
9- # Warning: changing this name to something else than '.venv' will make working with
10- # uv harder.
11- VENV ?= .venv
12-
13- # On Windows, venv scripts/shims are under `Scripts` instead of `bin`.
14- VENV_BIN := $(VENV ) /bin
15- ifeq ($(OS ) ,Windows_NT)
16- VENV_BIN := $(VENV)/Scripts
17- endif
18-
19- # Optionally overridden by the user in the `release` target.
20- BUMP_ARGS :=
21-
225# Optionally overridden by the user in the `test` target.
236TESTS :=
247
25- # Optionally overridden by the user/CI, to limit the installation to a specific
26- # subset of development dependencies.
27- INSTALL_EXTRA := dev
28-
298# If the user selects a specific test pattern to run, set `pytest` to fail fast
309# and only run tests that match the pattern.
3110# Otherwise, run all tests and enable coverage assertions, since we expect
@@ -42,21 +21,14 @@ endif
4221all :
4322 @echo " Run my targets individually!"
4423
45- .PHONY : dev
46- dev : $(VENV ) /pyvenv.cfg
47-
4824{%- if cookiecutter.entry_point %}
4925.PHONY : run
50- run : $( VENV ) /pyvenv.cfg
26+ run :
5127 uv run {{ cookiecutter.entry_point }} $(ARGS )
5228{%- endif %}
5329
54- $(VENV ) /pyvenv.cfg : pyproject.toml
55- uv venv $(VENV )
56- uv pip install -e ' .[$(INSTALL_EXTRA)]'
57-
5830.PHONY : lint
59- lint : $( VENV ) /pyvenv.cfg
31+ lint :
6032 uv run ruff format --check && \
6133 uv run ruff check && \
6234 uv run mypy
@@ -65,29 +37,25 @@ lint: $(VENV)/pyvenv.cfg
6537 uv run interrogate -c pyproject.toml .
6638 {%- endif %}
6739
68- .PHONY : reformat
69- reformat :
40+ .PHONY : format
41+ format :
7042 uv run ruff format && \
7143 uv run ruff check --fix
7244
73- .PHONY : test tests
74- test tests : $( VENV ) /pyvenv.cfg
45+ .PHONY : test
46+ test :
7547 uv run pytest --cov=$(PY_IMPORT ) $(T ) $(TEST_ARGS )
7648 uv run coverage report -m $(COV_ARGS )
7749
7850.PHONY : doc
7951{%- if cookiecutter.documentation == 'pdoc' %}
80- doc : $( VENV ) /pyvenv.cfg
52+ doc :
8153 uv run pdoc -o html $(PY_IMPORT )
8254{%- elif cookiecutter.documentation == 'none' %}
8355doc :
8456 @echo " No documentation set up"
8557{%- endif %}
8658
87- .PHONY : package
88- package : $( VENV ) /pyvenv.cfg
59+ .PHONY : build
60+ build :
8961 uv build
90-
91- .PHONY : edit
92- edit :
93- $(EDITOR ) $(ALL_PY_SRCS )
0 commit comments