Skip to content

Commit d924dca

Browse files
authored
Use .venv for default env name (#46)
1 parent 4e81aed commit d924dca

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

{{cookiecutter.project_slug}}/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
env/
1+
.venv/
22
pip-wheel-metadata/
33
*.egg-info/
44
__pycache__/

{{cookiecutter.project_slug}}/Makefile

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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`.
1214
VENV_BIN := $(VENV)/bin
@@ -46,44 +48,37 @@ dev: $(VENV)/pyvenv.cfg
4648
{%- if cookiecutter.entry_point %}
4749
.PHONY: run
4850
run: $(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
5959
lint: $(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
7169
reformat:
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
7774
test 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' %}
8480
doc: $(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' %}
8883
doc:
8984
@echo "No documentation set up"

0 commit comments

Comments
 (0)