forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 249
docs: regenerate INPUT parameter docs in RTD build #7621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhubonan
wants to merge
13
commits into
deepmodeling:develop
Choose a base branch
from
bonan-group:codex/rtd-parameter-docs
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2ee94ed
docs: regenerate input parameters in RTD build
zhubonan d25e07b
Merge branch 'develop' into codex/rtd-parameter-docs
zhubonan 4c3d43b
docs: preserve generated INPUT metadata
zhubonan 003c1a5
docs: add local manual build instructions
zhubonan 49f47e2
docs: generate input reference without checked-in yaml
zhubonan 6658864
tools: align governance input docs check
zhubonan c969a48
docs: fail RTD input reference refresh errors
zhubonan 2665ead
Update docs/README.md
zhubonan 408e321
docs: clarify local documentation build dependencies
zhubonan 614ff32
Merge remote-tracking branch 'official/develop' into codex/rtd-parame…
zhubonan 4f475f9
Merge branch 'develop' into codex/rtd-parameter-docs
zhubonan 9faa920
docs: generate input reference during builds
zhubonan 6b07fad
Merge remote-tracking branch 'origin/codex/rtd-parameter-docs' into c…
zhubonan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # ABACUS Documentation | ||
|
|
||
| These files are the source for the ABACUS manual published on Read the Docs. | ||
|
|
||
| Read the Docs builds a minimal serial ABACUS binary, regenerates | ||
| `docs/advanced/input_files/input-main.md` from that binary during the | ||
| documentation build, and fails the build if the INPUT reference cannot be | ||
| refreshed. | ||
|
|
||
| ## Build the Manual Locally | ||
|
|
||
| Run the following commands from the repository root. | ||
|
|
||
| 1. Create a Python virtual environment: | ||
|
|
||
| ```bash | ||
| python3 -m venv .venv | ||
| source .venv/bin/activate | ||
| ``` | ||
|
|
||
| 1. Install the Python documentation requirements: | ||
|
|
||
| ```bash | ||
| pip3 install -r docs/requirements.txt | ||
| ``` | ||
|
|
||
| The reduced ABACUS build also requires a C++ compiler, a Fortran compiler, | ||
| CMake, Ninja, FFTW3, BLAS, and LAPACK. These are system/build dependencies, | ||
| not Python documentation dependencies. | ||
|
|
||
| 1. Build the reduced ABACUS executable used for INPUT parameter metadata: | ||
|
|
||
| ```bash | ||
| cmake -S . -B build-rtd-docs -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DENABLE_MPI=OFF \ | ||
| -DENABLE_LCAO=OFF \ | ||
| -DUSE_OPENMP=OFF \ | ||
| -DUSE_ELPA=OFF \ | ||
| -DUSE_CUDA=OFF \ | ||
| -DUSE_ROCM=OFF \ | ||
| -DBUILD_TESTING=OFF \ | ||
| -DENABLE_LIBXC=OFF \ | ||
| -DENABLE_LIBRI=OFF \ | ||
| -DENABLE_DFTD4=OFF \ | ||
| -DENABLE_RAPIDJSON=OFF \ | ||
| -DENABLE_MLALGO=OFF \ | ||
| -DENABLE_FLOAT_FFTW=OFF \ | ||
| -DENABLE_CNPY=OFF \ | ||
| -DCOMMIT_INFO=OFF \ | ||
| -DGIT_SUBMODULE=OFF \ | ||
| -DMKLROOT=OFF | ||
| cmake --build build-rtd-docs --target abacus_pw_ser --parallel 2 | ||
| ``` | ||
|
|
||
| 1. (Optional) Generate the INPUT reference manually for inspection: | ||
|
|
||
| The ABACUS executable emits the parameter metadata as a transient YAML | ||
| stream. Pipe that stream directly to the Markdown generator; neither | ||
| `docs/parameters.yaml` nor `docs/advanced/input_files/input-main.md` is | ||
| maintained in the repository. | ||
|
|
||
| ```bash | ||
| ./build-rtd-docs/abacus_pw_ser --generate-parameters-yaml \ | ||
| | .venv/bin/python docs/generate_input_main.py - \ | ||
| --output /tmp/input-main.md | ||
| ``` | ||
|
|
||
| 1. Build the HTML manual: | ||
|
|
||
| ```bash | ||
| ABACUS_BINARY=./build-rtd-docs/abacus_pw_ser \ | ||
| .venv/bin/sphinx-build -b html docs build-docs/html | ||
| ``` | ||
|
|
||
| If `ABACUS_BINARY` is not set, `docs/conf.py` looks for the Read the Docs | ||
| build binary and then for `abacus` or `abacus_pw_ser` on `PATH`. | ||
|
|
||
| 1. Open `build-docs/html/index.html` in a browser. | ||
|
|
||
| Every documentation build requires an ABACUS executable. If no executable is | ||
| available, or if parameter generation fails, Sphinx stops with an error rather | ||
| than publishing incomplete or stale INPUT documentation. | ||
|
|
||
| ## Regenerate Only the INPUT Reference | ||
|
|
||
| To refresh only the generated INPUT reference after building ABACUS, pipe the | ||
| transient YAML stream directly into the Markdown generator: | ||
|
|
||
| ```bash | ||
| ./build-rtd-docs/abacus_pw_ser --generate-parameters-yaml \ | ||
| | .venv/bin/python docs/generate_input_main.py - \ | ||
| --output /tmp/input-main.md | ||
| ``` | ||
|
|
||
| ## INPUT Parameter Reference | ||
|
|
||
| The INPUT parameter reference is generated from metadata registered in | ||
| `source/source_io/module_parameter/read_input_item_*.cpp`. | ||
|
|
||
| - `abacus --generate-parameters-yaml` produces a transient YAML stream; it is | ||
| not stored in the repository. | ||
| - `docs/advanced/input_files/input-main.md` is generated from that metadata | ||
| during every Sphinx build and is not stored in the repository. | ||
| - `docs/conf.py` requires an ABACUS executable and fails the build if the INPUT | ||
| reference cannot be generated. | ||
|
|
||
| PRs that change INPUT metadata only update the C++ `Input_Item` registrations. | ||
| The YAML stream and Markdown reference are both transient build artifacts. | ||
|
|
||
| ## Optional Read the Docs Container Test | ||
|
|
||
| To smoke-test the Read the Docs environment locally, use the same image as the | ||
| hosted build: | ||
|
|
||
| ```bash | ||
| docker run --rm --user root -v "$PWD:/project" -w /project \ | ||
| readthedocs/build:ubuntu-22.04-2024.01.29 \ | ||
| /bin/bash -lc 'apt-get update && | ||
| apt-get install -y build-essential cmake gfortran git libfftw3-dev \ | ||
| liblapack-dev libopenblas-dev ninja-build pkg-config python3-pip && | ||
| python3 -m pip install -r docs/requirements.txt && | ||
| cmake -S . -B /tmp/build-rtd-docs -G Ninja -DCMAKE_BUILD_TYPE=Release \ | ||
| -DENABLE_MPI=OFF -DENABLE_LCAO=OFF -DUSE_OPENMP=OFF -DUSE_ELPA=OFF \ | ||
| -DUSE_CUDA=OFF -DUSE_ROCM=OFF -DBUILD_TESTING=OFF \ | ||
| -DENABLE_LIBXC=OFF -DENABLE_LIBRI=OFF -DENABLE_DFTD4=OFF \ | ||
| -DENABLE_RAPIDJSON=OFF -DENABLE_MLALGO=OFF -DENABLE_FLOAT_FFTW=OFF \ | ||
| -DENABLE_CNPY=OFF -DCOMMIT_INFO=OFF -DGIT_SUBMODULE=OFF -DMKLROOT=OFF && | ||
| cmake --build /tmp/build-rtd-docs --target abacus_pw_ser --parallel 2 && | ||
| export READTHEDOCS=True ABACUS_BINARY=/tmp/build-rtd-docs/abacus_pw_ser && | ||
| sphinx-build -b html docs /tmp/abacus-docs-html' | ||
| ``` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.