Skip to content

Commit 6f1f2cb

Browse files
authored
refactor: refine Makefile (#639)
1 parent e719e67 commit 6f1f2cb

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ build:
2626
post_install:
2727
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make dev-doc
2828
post_build:
29-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make doc-mypy doc-coverage
29+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make mypy doc-coverage
3030
os: ubuntu-22.04
3131
tools:
3232
python: '3.12'

Makefile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc consistency
1+
.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-autobuild doc-build doc-coverage doc consistency
22

33
########################################################################################
44
# Variables
@@ -42,16 +42,16 @@ deepclean: clean
4242

4343
# Install the package in editable mode.
4444
install:
45-
pdm install --prod
45+
pdm sync --prod
4646

4747
# Install the package in editable mode with specific optional dependencies.
4848
dev-%:
49-
pdm install --dev --group $*
49+
pdm sync --dev --group $*
5050

5151
# Prepare the development environment.
5252
# Install the package in editable mode with all optional dependencies and pre-commit hook.
5353
dev:
54-
pdm install
54+
pdm sync
5555
if [ "$(CI)" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install; fi
5656

5757
# Install standalone tools
@@ -72,7 +72,7 @@ endif
7272

7373
# Check lint with mypy.
7474
mypy:
75-
pdm run python -m mypy .
75+
pdm run python -m mypy . --html-report $(PUBLIC_DIR)/reports/mypy
7676

7777
# Lint with ruff.
7878
ruff:
@@ -135,20 +135,16 @@ doc-autobuild:
135135
-a
136136

137137
# Build documentation only from src.
138-
doc-gen:
138+
doc-build:
139139
pdm run python -m sphinx.cmd.build docs $(PUBLIC_DIR)
140140

141-
# Generate mypy reports.
142-
doc-mypy:
143-
pdm run python -m mypy src tests --html-report $(PUBLIC_DIR)/reports/mypy
144-
145141
# Generate html coverage reports with badge.
146142
doc-coverage: test-run
147143
pdm run python -m coverage html -d $(PUBLIC_DIR)/reports/coverage
148144
pdm run bash scripts/generate-coverage-badge.sh $(PUBLIC_DIR)/_static/badges
149145

150146
# Generate all documentation with reports.
151-
doc: doc-gen doc-mypy doc-coverage
147+
doc: doc-build mypy doc-coverage
152148

153149
########################################################################################
154150
# Template

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ enable_error_code = [
129129
]
130130
exclude = [
131131
"build",
132+
"doc",
132133
"template",
133134
]
134135
no_implicit_optional = true

template/.readthedocs.yaml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ build:
2626
post_install:
2727
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make dev-doc
2828
post_build:
29-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make doc-mypy doc-coverage
29+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make mypy doc-coverage
3030
os: ubuntu-22.04
3131
tools:
3232
python: '{{ default_py }}'

template/Makefile.jinja

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[% from pathjoin("includes", "variable.jinja") import page_url with context -%]
2-
.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc
2+
.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-autobuild doc-build doc-coverage doc
33
[%- if project_name == "Serious Scaffold Python" %] consistency[% endif %]
44

55
########################################################################################
@@ -44,16 +44,16 @@ deepclean: clean
4444

4545
# Install the package in editable mode.
4646
install:
47-
pdm install --prod
47+
pdm sync --prod
4848

4949
# Install the package in editable mode with specific optional dependencies.
5050
dev-%:
51-
pdm install --dev --group $*
51+
pdm sync --dev --group $*
5252

5353
# Prepare the development environment.
5454
# Install the package in editable mode with all optional dependencies and pre-commit hook.
5555
dev:
56-
pdm install
56+
pdm sync
5757
if [ "$(CI)" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install; fi
5858

5959
# Install standalone tools
@@ -74,7 +74,7 @@ endif
7474

7575
# Check lint with mypy.
7676
mypy:
77-
pdm run python -m mypy .
77+
pdm run python -m mypy . --html-report $(PUBLIC_DIR)/reports/mypy
7878

7979
# Lint with ruff.
8080
ruff:
@@ -137,20 +137,16 @@ doc-autobuild:
137137
-a
138138

139139
# Build documentation only from src.
140-
doc-gen:
140+
doc-build:
141141
pdm run python -m sphinx.cmd.build docs $(PUBLIC_DIR)
142142

143-
# Generate mypy reports.
144-
doc-mypy:
145-
pdm run python -m mypy src tests --html-report $(PUBLIC_DIR)/reports/mypy
146-
147143
# Generate html coverage reports with badge.
148144
doc-coverage: test-run
149145
pdm run python -m coverage html -d $(PUBLIC_DIR)/reports/coverage
150146
pdm run bash scripts/generate-coverage-badge.sh $(PUBLIC_DIR)/_static/badges
151147

152148
# Generate all documentation with reports.
153-
doc: doc-gen doc-mypy doc-coverage
149+
doc: doc-build mypy doc-coverage
154150

155151
[% if project_name == "Serious Scaffold Python" -%]
156152
########################################################################################

template/pyproject.toml.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ enable_error_code = [
170170
]
171171
exclude = [
172172
"build",
173+
"doc",
173174
[%- if project_name == "Serious Scaffold Python" %]
174175
"template",
175176
[%- endif %]

0 commit comments

Comments
 (0)