Skip to content

Commit dbf394e

Browse files
Add aggregate docs check (#3527)
* Add aggregate docs check * style: auto-fix by pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d72a334 commit dbf394e

4 files changed

Lines changed: 94 additions & 66 deletions

File tree

.github/workflows/llms-txt.yaml

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
1-
name: Update llms.txt
1+
name: Docs Check All
22

33
on:
44
pull_request:
55
branches: [main]
66
paths:
7+
- '.github/workflows/llms-txt.yaml'
8+
- '.github/workflows/playground-lint.yaml'
9+
- 'README.md'
10+
- 'docs/**'
11+
- 'pyproject.toml'
12+
- 'scripts/build_architecture_docs.py'
713
- 'src/datamodel_code_generator/**'
8-
- 'tests/main/**'
9-
- 'tests/data/jsonschema/tutorial_pet.json'
10-
- 'tests/test_main_kr.py'
1114
- 'scripts/build_cli_docs.py'
12-
- 'scripts/build_prompt_data.py'
15+
- 'scripts/build_conformance_docs.py'
16+
- 'scripts/build_deprecation_docs.py'
17+
- 'scripts/build_diagrams.py'
18+
- 'scripts/build_docs_examples.py'
19+
- 'scripts/build_experimental_docs.py'
20+
- 'scripts/build_release_benchmark_docs.py'
21+
- 'scripts/build_llms_txt.py'
22+
- 'scripts/build_playground_assets.py'
1323
- 'scripts/build_preset_docs.py'
14-
- 'src/datamodel_code_generator/parser/schema_version.py'
24+
- 'scripts/build_prompt_data.py'
1525
- 'scripts/build_schema_docs.py'
16-
- 'scripts/build_release_benchmark_docs.py'
17-
- 'docs/data/release-benchmarks.json'
18-
- 'docs/data/release-benchmark-notes.json'
19-
- 'docs/assets/benchmarks/release-benchmarks.css'
20-
- 'docs/assets/benchmarks/release-benchmarks.js'
21-
- 'docs/**/*.md'
22-
- 'README.md'
26+
- 'scripts/update_command_help_on_markdown.py'
27+
- 'scripts/update_generate_prompt_snapshots.py'
28+
- 'tests/data/expected/main/jsonschema/**'
29+
- 'tests/data/expected/main/openapi/**'
30+
- 'tests/data/jsonschema/**'
31+
- 'tests/data/openapi/**'
32+
- 'tests/main/**'
33+
- 'tests/test_main_kr.py'
34+
- 'tox.ini'
35+
- 'uv.lock'
2336
- 'zensical.toml'
24-
- 'scripts/build_llms_txt.py'
2537

2638
permissions:
2739
contents: read
2840

2941
jobs:
30-
update-llms-txt:
31-
runs-on: ubuntu-latest
42+
docs-check-all:
43+
runs-on: ubuntu-24.04
3244
steps:
3345
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3446
with:
@@ -38,41 +50,18 @@ jobs:
3850
persist-credentials: false
3951
- name: Install the latest version of uv
4052
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
41-
- name: Install tox
42-
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
43-
- name: Setup README environment
44-
run: tox run -vv --notest --skip-missing-interpreters false -e readme
45-
env:
46-
UV_PYTHON_PREFERENCE: "only-managed"
47-
- name: Setup CLI docs environment
48-
run: tox run -vv --notest --skip-missing-interpreters false -e cli-docs
49-
env:
50-
UV_PYTHON_PREFERENCE: "only-managed"
51-
- name: Setup schema docs environment
52-
run: tox run -vv --notest --skip-missing-interpreters false -e schema-docs
53+
with:
54+
enable-cache: true
55+
cache-suffix: docs-check-all
56+
- name: Setup Python
57+
run: uv python install 3.14
5358
env:
5459
UV_PYTHON_PREFERENCE: "only-managed"
55-
- name: Setup preset docs environment
56-
run: tox run -vv --notest --skip-missing-interpreters false -e preset-docs
60+
- name: Install tox
61+
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
5762
env:
5863
UV_PYTHON_PREFERENCE: "only-managed"
59-
- name: Setup llms.txt environment
60-
run: tox run -vv --notest --skip-missing-interpreters false -e llms-txt
64+
- name: Run aggregate docs check
65+
run: tox run -e docs-check-all -- --check
6166
env:
6267
UV_PYTHON_PREFERENCE: "only-managed"
63-
- name: Update README
64-
run: .tox/readme/bin/python scripts/update_command_help_on_markdown.py
65-
- name: Collect CLI doc metadata
66-
run: .tox/cli-docs/bin/pytest tests --collect-cli-docs -p no:xdist -q
67-
- name: Build CLI docs
68-
run: .tox/cli-docs/bin/python scripts/build_cli_docs.py
69-
- name: Build prompt data
70-
run: .tox/cli-docs/bin/python scripts/build_prompt_data.py
71-
- name: Build schema docs
72-
run: .tox/schema-docs/bin/python scripts/build_schema_docs.py
73-
- name: Build preset docs
74-
run: .tox/preset-docs/bin/python scripts/build_preset_docs.py
75-
- name: Build release benchmark docs
76-
run: .tox/llms-txt/bin/python scripts/build_release_benchmark_docs.py
77-
- name: Build llms.txt
78-
run: .tox/llms-txt/bin/python scripts/build_llms_txt.py

docs/development-contributing.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ $ tox run -e 3.13
4242
## 8. Format and lint code (will print errors that cannot be automatically fixed)
4343
$ tox run -e fix
4444

45-
## 9. Check README help text is up to date
46-
$ tox run -e readme
45+
## 9. Check generated docs, diagrams, and playground assets are up to date
46+
$ tox run -e docs-check-all -- --check
4747

48-
## 10. Check CLI documentation is up to date
49-
$ tox run -e cli-docs
50-
51-
## 11. Commit and Push...
48+
## 10. Commit and Push...
5249
```
5350

5451
## 🧪 E2E test assertions
@@ -179,16 +176,16 @@ CLI_OPTION_META: dict[str, CLIOptionMeta] = {
179176
$ pytest --collect-cli-docs -p no:xdist -q
180177
$ python scripts/build_cli_docs.py
181178

182-
# Verify docs are correct
183-
$ tox run -e cli-docs
179+
# Verify generated docs are correct
180+
$ tox run -e docs-check-all -- --check
184181

185182
# If you modified config.py, regenerate config TypedDicts
186183
$ tox run -e config-types
187184
```
188185

189186
### 🔧 Troubleshooting
190187

191-
If `tox run -e cli-docs` fails:
188+
If the `tox run -e docs-check-all -- --check` CLI docs step fails:
192189

193190
- **"No test found documenting option --xxx"**: Add `@pytest.mark.cli_doc(options=["--xxx"], ...)` to a test
194191
- **"File not found: ..."**: Check that `input_schema` and `golden_output` paths are correct

docs/llms-full.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37534,13 +37534,10 @@ $ tox run -e 3.13
3753437534
## 8. Format and lint code (will print errors that cannot be automatically fixed)
3753537535
$ tox run -e fix
3753637536

37537-
## 9. Check README help text is up to date
37538-
$ tox run -e readme
37537+
## 9. Check generated docs, diagrams, and playground assets are up to date
37538+
$ tox run -e docs-check-all -- --check
3753937539

37540-
## 10. Check CLI documentation is up to date
37541-
$ tox run -e cli-docs
37542-
37543-
## 11. Commit and Push...
37540+
## 10. Commit and Push...
3754437541
```
3754537542

3754637543
## 🧪 E2E test assertions
@@ -37671,16 +37668,16 @@ CLI_OPTION_META: dict[str, CLIOptionMeta] = {
3767137668
$ pytest --collect-cli-docs -p no:xdist -q
3767237669
$ python scripts/build_cli_docs.py
3767337670

37674-
# Verify docs are correct
37675-
$ tox run -e cli-docs
37671+
# Verify generated docs are correct
37672+
$ tox run -e docs-check-all -- --check
3767637673

3767737674
# If you modified config.py, regenerate config TypedDicts
3767837675
$ tox run -e config-types
3767937676
```
3768037677

3768137678
### 🔧 Troubleshooting
3768237679

37683-
If `tox run -e cli-docs` fails:
37680+
If the `tox run -e docs-check-all -- --check` CLI docs step fails:
3768437681

3768537682
- **"No test found documenting option --xxx"**: Add `@pytest.mark.cli_doc(options=["--xxx"], ...)` to a test
3768637683
- **"File not found: ..."**: Check that `input_schema` and `golden_output` paths are correct

tox.ini

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,51 @@ commands =
242242
-q
243243
dependency_groups = test
244244

245+
[testenv:generated-docs-check]
246+
description = Validate generated documentation and prompt snapshots without modifying files
247+
base_python = python3.14
248+
set_env =
249+
{[testenv]set_env}
250+
PYTHONPATH = {tox_root}{/}src
251+
commands =
252+
python scripts/update_command_help_on_markdown.py {posargs:--check}
253+
pytest tests --collect-cli-docs -p no:xdist -q
254+
python scripts/build_cli_docs.py {posargs:--check}
255+
python scripts/build_prompt_data.py {posargs:--check}
256+
python scripts/update_generate_prompt_snapshots.py {posargs:--check}
257+
python scripts/build_preset_docs.py {posargs:--check}
258+
python scripts/build_schema_docs.py {posargs:--check}
259+
python scripts/build_docs_examples.py {posargs:--check}
260+
python scripts/build_deprecation_docs.py {posargs:--check}
261+
python scripts/build_experimental_docs.py {posargs:--check}
262+
python scripts/build_conformance_docs.py {posargs:--check}
263+
python scripts/build_architecture_docs.py {posargs:--check}
264+
python scripts/build_release_benchmark_docs.py {posargs:--check}
265+
python scripts/build_llms_txt.py {posargs:--check}
266+
pytest \
267+
tests/test_main_kr.py::test_generate_prompt_basic \
268+
tests/test_main_kr.py::test_generate_prompt_with_question \
269+
tests/test_main_kr.py::test_generate_prompt_with_options \
270+
tests/test_main_kr.py::test_generate_prompt_with_list_options \
271+
-p no:xdist \
272+
-q
273+
dependency_groups = test
274+
275+
[testenv:docs-check-all]
276+
description = Validate generated docs, rendered diagrams, and playground asset lint
277+
base_python = {[testenv:generated-docs-check]base_python}
278+
set_env =
279+
{[testenv:generated-docs-check]set_env}
280+
commands =
281+
{[testenv:generated-docs-check]commands}
282+
python scripts/build_diagrams.py {posargs:--check}
283+
python scripts/build_playground_assets.py
284+
t-linter check --error-on-issues docs/assets/playground/app.py
285+
t-linter format --check docs/assets/playground/app.py
286+
dependency_groups =
287+
test
288+
playground
289+
245290
[testenv:config-types]
246291
description = Generate TypedDict files from config models (use --check to validate only)
247292
commands =

0 commit comments

Comments
 (0)