Skip to content

Commit df59e09

Browse files
authored
treewide: PEP 517/8 (#63)
1 parent 9d8bf64 commit df59e09

16 files changed

+227
-2581
lines changed

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

Makefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
SHELL := /bin/bash
2+
3+
PY_MODULE := stdlib_list
4+
5+
ALL_PY_SRCS := $(shell find $(PY_MODULE) -name '*.py') \
6+
$(shell find tests -name '*.py')
7+
8+
# Optionally overriden by the user, if they're using a virtual environment manager.
9+
VENV ?= env
10+
11+
# On Windows, venv scripts/shims are under `Scripts` instead of `bin`.
12+
VENV_BIN := $(VENV)/bin
13+
ifeq ($(OS),Windows_NT)
14+
VENV_BIN := $(VENV)/Scripts
15+
endif
16+
17+
# Optionally overridden by the user in the `release` target.
18+
BUMP_ARGS :=
19+
20+
# Optionally overridden by the user in the `test` target.
21+
TESTS :=
22+
23+
# Optionally overridden by the user/CI, to limit the installation to a specific
24+
# subset of development dependencies.
25+
INSTALL_EXTRA := dev
26+
27+
# If the user selects a specific test pattern to run, set `pytest` to fail fast
28+
# and only run tests that match the pattern.
29+
# Otherwise, run all tests and enable coverage assertions, since we expect
30+
# complete test coverage.
31+
ifneq ($(TESTS),)
32+
TEST_ARGS := -x -k $(TESTS)
33+
COV_ARGS :=
34+
else
35+
TEST_ARGS :=
36+
COV_ARGS := --fail-under 100
37+
endif
38+
39+
.PHONY: all
40+
all:
41+
@echo "Run my targets individually!"
42+
43+
.PHONY: dev
44+
dev: $(VENV)/pyvenv.cfg
45+
46+
.PHONY: run
47+
run: $(VENV)/pyvenv.cfg
48+
@. $(VENV_BIN)/activate && pip-audit $(ARGS)
49+
50+
$(VENV)/pyvenv.cfg: pyproject.toml
51+
# Create our Python 3 virtual environment
52+
python3 -m venv env
53+
$(VENV_BIN)/python -m pip install --upgrade pip
54+
$(VENV_BIN)/python -m pip install -e .[$(INSTALL_EXTRA)]
55+
56+
.PHONY: lint
57+
lint: $(VENV)/pyvenv.cfg
58+
. $(VENV_BIN)/activate && \
59+
black --check $(ALL_PY_SRCS) && \
60+
ruff $(ALL_PY_SRCS) && \
61+
mypy $(PY_MODULE)
62+
63+
.PHONY: reformat
64+
reformat:
65+
. $(VENV_BIN)/activate && \
66+
ruff --fix $(ALL_PY_SRCS) && \
67+
black $(ALL_PY_SRCS)
68+
69+
.PHONY: test tests
70+
test tests: $(VENV)/pyvenv.cfg
71+
. $(VENV_BIN)/activate && \
72+
pytest --cov=$(PY_MODULE) $(T) $(TEST_ARGS) && \
73+
python -m coverage report -m $(COV_ARGS)
74+
75+
.PHONY: doc
76+
doc: $(VENV)/pyvenv.cfg
77+
. $(VENV_BIN)/activate && \
78+
$(MAKE) -C docs html
79+
80+
.PHONY: package
81+
package: $(VENV)/pyvenv.cfg
82+
. $(VENV_BIN)/activate && \
83+
python3 -m build

0 commit comments

Comments
 (0)