Skip to content

Commit d0cc120

Browse files
committed
remove complicated venv management from Makefile
uv does all this stuff automatically already uv run also installs the dev group by default so there's no need to make it configurable
1 parent d651385 commit d0cc120

5 files changed

Lines changed: 8 additions & 42 deletions

File tree

.github/workflows/tests.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
3636
cd /tmp/python-project
3737
git init . && git add . && git commit -m "Initial commit"
38-
make dev
3938
make reformat
4039
4140
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
@@ -54,7 +53,6 @@ jobs:
5453
5554
cd /tmp/python-project
5655
git init . && git add . && git commit -m "Initial commit"
57-
make dev
5856
make reformat
5957
6058
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
@@ -73,7 +71,6 @@ jobs:
7371
7472
cd /tmp/tob-r-and-e-python-project
7573
git init . && git add . && git commit -m "Initial commit"
76-
make dev
7774
make reformat
7875
7976
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
@@ -92,7 +89,6 @@ jobs:
9289
9390
cd /tmp/bit-trails
9491
git init . && git add . && git commit -m "Initial commit"
95-
make dev
9692
make reformat
9793
9894
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
@@ -112,7 +108,6 @@ jobs:
112108
113109
cd /tmp/python-project
114110
git init . && git add . && git commit -m "Initial commit"
115-
make dev
116111
make reformat
117112
118113
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }

{{cookiecutter.project_slug}}/.github/workflows/docs.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ jobs:
1818
- name: Install uv
1919
uses: astral-sh/setup-uv@445689ea25e0de0a23313031f5fe577c74ae45a1 # v6.3.0
2020

21-
- name: setup
22-
run: |
23-
make dev INSTALL_EXTRA=doc
24-
2521
- name: build docs
2622
run: |
2723
make doc

{{cookiecutter.project_slug}}/.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
uses: astral-sh/setup-uv@445689ea25e0de0a23313031f5fe577c74ae45a1 # v6.3.0
2121

2222
- name: lint
23-
run: make lint INSTALL_EXTRA=lint
23+
run: make lint

{{cookiecutter.project_slug}}/.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
python-version: ${{ matrix.python }}
3030

3131
- name: test
32-
run: make test INSTALL_EXTRA=test
32+
run: make test

{{cookiecutter.project_slug}}/Makefile

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,9 @@ SHELL := /bin/bash
22

33
PY_IMPORT = {{ cookiecutter.__project_import }}
44

5-
# Optionally overriden by the user, if they're using a virtual environment manager.
6-
# Warning: changing this name to something else than '.venv' will make working with
7-
# uv harder.
8-
VENV ?= .venv
9-
10-
# On Windows, venv scripts/shims are under `Scripts` instead of `bin`.
11-
VENV_BIN := $(VENV)/bin
12-
ifeq ($(OS),Windows_NT)
13-
VENV_BIN := $(VENV)/Scripts
14-
endif
15-
16-
# Optionally overridden by the user in the `release` target.
17-
BUMP_ARGS :=
18-
195
# Optionally overridden by the user in the `test` target.
206
TESTS :=
217

22-
# Optionally overridden by the user/CI, to limit the installation to a specific
23-
# subset of development dependencies.
24-
INSTALL_EXTRA := dev
25-
268
# If the user selects a specific test pattern to run, set `pytest` to fail fast
279
# and only run tests that match the pattern.
2810
# Otherwise, run all tests and enable coverage assertions, since we expect
@@ -39,21 +21,14 @@ endif
3921
all:
4022
@echo "Run my targets individually!"
4123

42-
.PHONY: dev
43-
dev: $(VENV)/pyvenv.cfg
44-
4524
{%- if cookiecutter.entry_point %}
4625
.PHONY: run
47-
run: $(VENV)/pyvenv.cfg
26+
run:
4827
uv run {{ cookiecutter.entry_point }} $(ARGS)
4928
{%- endif %}
5029

51-
$(VENV)/pyvenv.cfg: pyproject.toml
52-
uv venv $(VENV)
53-
uv sync --group '$(INSTALL_EXTRA)'
54-
5530
.PHONY: lint
56-
lint: $(VENV)/pyvenv.cfg
31+
lint:
5732
uv run ruff format --check && \
5833
uv run ruff check && \
5934
uv run mypy
@@ -67,20 +42,20 @@ reformat:
6742
uv run ruff format && \
6843
uv run ruff check --fix
6944

70-
.PHONY: test tests
71-
test tests: $(VENV)/pyvenv.cfg
45+
.PHONY: test
46+
test:
7247
uv run pytest --cov=$(PY_IMPORT) $(T) $(TEST_ARGS)
7348
uv run coverage report -m $(COV_ARGS)
7449

7550
.PHONY: doc
7651
{%- if cookiecutter.documentation == 'pdoc' %}
77-
doc: $(VENV)/pyvenv.cfg
52+
doc:
7853
uv run pdoc -o html $(PY_IMPORT)
7954
{%- elif cookiecutter.documentation == 'none' %}
8055
doc:
8156
@echo "No documentation set up"
8257
{%- endif %}
8358

8459
.PHONY: package
85-
package: $(VENV)/pyvenv.cfg
60+
package:
8661
uv build

0 commit comments

Comments
 (0)