Skip to content

Commit 7ed6c0a

Browse files
committed
chore: watch docs and template
1 parent ba48e0a commit 7ed6c0a

File tree

9 files changed

+27
-74
lines changed

9 files changed

+27
-74
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
git config --global user.name github-actions
7070
git config --global user.email [email protected]
7171
- run: pipx install copier==9.3.1
72-
- run: make consistency
72+
- run: make template-build
7373
- run: git diff
7474
- run: git status --porcelain
7575
- run: test -z "$(git status --porcelain)"

.gitlab/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ consistency:
3939
- git config --global user.name gitlab-ci
4040
- git config --global user.email [email protected]
4141
- pipx install copier==9.3.1
42-
- make consistency
42+
- make template-build
4343
- git diff
4444
- git status --porcelain
4545
- test -z "$(git status --porcelain)"

Makefile

Lines changed: 10 additions & 8 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-build 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-watch doc-build doc-coverage doc template-watch template-build
22

33
########################################################################################
44
# Variables
@@ -65,6 +65,7 @@ else
6565
endif
6666
pipx install --force pyproject-fmt==2.1.4
6767
pipx install --force ruff==0.5.1
68+
pipx install --force watchfiles==0.22.0
6869

6970
########################################################################################
7071
# Lint and pre-commit
@@ -128,15 +129,13 @@ publish:
128129
########################################################################################
129130

130131
# Generate documentation with auto build when changes happen.
131-
doc-autobuild:
132-
pdm run python -m sphinx_autobuild docs $(PUBLIC_DIR) \
133-
--watch README.md \
134-
--watch src \
135-
-a
132+
doc-watch:
133+
pdm run python -m http.server --directory public &
134+
watchfiles "make doc-build" docs src README.md
136135

137136
# Build documentation only from src.
138137
doc-build:
139-
pdm run python -m sphinx.cmd.build docs $(PUBLIC_DIR)
138+
pdm run sphinx-build -a docs $(PUBLIC_DIR)
140139

141140
# Generate html coverage reports with badge.
142141
doc-coverage: test-run
@@ -150,7 +149,10 @@ doc: doc-build mypy doc-coverage
150149
# Template
151150
########################################################################################
152151

153-
consistency:
152+
template-watch:
153+
watchfiles "make template-build" template includes copier.yaml
154+
155+
template-build:
154156
find . -maxdepth 1 | grep -vE '(\.|\.git|template|includes|copier\.yaml|pdm\.lock)$$' | xargs -I {} rm -r {}
155157
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_platform=gitlab -f . .
156158
rm -rf .copier-answers.yml

pdm.lock

Lines changed: 2 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ doc = [
5555
"mypy[reports]",
5656
"myst-parser",
5757
"pytest",
58-
"sphinx-autobuild",
5958
"sphinx-click",
6059
"sphinx-design",
6160
]

template/Makefile.jinja

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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-build doc-coverage doc
3-
[%- if project_name == "Serious Scaffold Python" %] consistency[% endif %]
2+
.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-watch doc-build doc-coverage doc
3+
[%- if project_name == "Serious Scaffold Python" %] template-watch template-build[% endif %]
44

55
########################################################################################
66
# Variables
@@ -67,6 +67,7 @@ else
6767
endif
6868
pipx install --force pyproject-fmt==2.1.4
6969
pipx install --force ruff==0.5.1
70+
pipx install --force watchfiles==0.22.0
7071

7172
########################################################################################
7273
# Lint and pre-commit
@@ -130,15 +131,13 @@ publish:
130131
########################################################################################
131132

132133
# Generate documentation with auto build when changes happen.
133-
doc-autobuild:
134-
pdm run python -m sphinx_autobuild docs $(PUBLIC_DIR) \
135-
--watch README.md \
136-
--watch src \
137-
-a
134+
doc-watch:
135+
pdm run python -m http.server --directory public &
136+
watchfiles "make doc-build" docs src README.md
138137

139138
# Build documentation only from src.
140139
doc-build:
141-
pdm run python -m sphinx.cmd.build docs $(PUBLIC_DIR)
140+
pdm run sphinx-build -a docs $(PUBLIC_DIR)
142141

143142
# Generate html coverage reports with badge.
144143
doc-coverage: test-run
@@ -153,7 +152,10 @@ doc: doc-build mypy doc-coverage
153152
# Template
154153
########################################################################################
155154

156-
consistency:
155+
template-watch:
156+
watchfiles "make template-build" template includes copier.yaml
157+
158+
template-build:
157159
find . -maxdepth 1 | grep -vE '(\.|\.git|template|includes|copier\.yaml|pdm\.lock)$$' | xargs -I {} rm -r {}
158160
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_platform=gitlab -f . .
159161
rm -rf .copier-answers.yml

template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
git config --global user.name github-actions
9898
git config --global user.email [email protected]
9999
- run: pipx install copier==9.3.1
100-
- run: make consistency
100+
- run: make template-build
101101
- run: git diff
102102
- run: git status --porcelain
103103
- run: test -z "$(git status --porcelain)"

template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ consistency:
5151
- git config --global user.name gitlab-ci
5252
- git config --global user.email [email protected]
5353
- pipx install copier==9.3.1
54-
- make consistency
54+
- make template-build
5555
- git diff
5656
- git status --porcelain
5757
- test -z "$(git status --porcelain)"

template/pyproject.toml.jinja

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ doc = [
9494
"mypy[reports]",
9595
"myst-parser",
9696
"pytest",
97-
"sphinx-autobuild",
9897
"sphinx-click",
9998
"sphinx-design",
10099
]

0 commit comments

Comments
 (0)