-
Notifications
You must be signed in to change notification settings - Fork 238
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
base: develop
Are you sure you want to change the base?
Changes from all commits
2ee94ed
d25e07b
4c3d43b
003c1a5
49f47e2
6658864
c969a48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,110 @@ | ||||||
| # 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 with `uv`: | ||||||
|
|
||||||
| ```bash | ||||||
| uv venv --python python3 .venv | ||||||
| ``` | ||||||
|
|
||||||
| 1. Install the documentation requirements: | ||||||
|
|
||||||
| ```bash | ||||||
| uv pip install --python .venv/bin/python -r docs/requirements.txt sphinx ninja | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Would suggest to add |
||||||
| ``` | ||||||
|
|
||||||
| 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 | ||||||
|
Comment on lines
+26
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be clear about "how to use an ABACUS binary to generate the For example: 1. (optional) Build an ABACUS binary and use it to generate the `parameters.yaml` file:
```bash
./bin/abacus --generate-parameters-yaml > docs/parameters.yaml
```
1. (optional) Generate Markdown pages from the `parameters.yaml` file:
```bash
python3 docs/generate_input_main.py docs/parameters.yaml
```The below section about INPUT reference is a nice description but cannot replace the instruction here. |
||||||
| ``` | ||||||
|
|
||||||
| 1. Build the HTML manual: | ||||||
|
|
||||||
| ```bash | ||||||
| ABACUS_BINARY=./build-rtd-docs/source/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. | ||||||
|
|
||||||
| For local builds, if no ABACUS executable is available, the Sphinx build still | ||||||
| continues with the checked-in `docs/advanced/input_files/input-main.md` and | ||||||
| prints a warning that the INPUT parameter reference may not be up to date. | ||||||
|
|
||||||
| ## Regenerate Only the INPUT Reference | ||||||
|
|
||||||
| To refresh only the generated INPUT reference after building ABACUS: | ||||||
|
|
||||||
| ```bash | ||||||
| ./build-rtd-docs/source/abacus_pw_ser --generate-parameters-yaml \ | ||||||
| | .venv/bin/python docs/generate_input_main.py - \ | ||||||
| --output docs/advanced/input_files/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. | ||||||
| - `docs/conf.py` refreshes `input-main.md` automatically when it can find an | ||||||
| ABACUS executable. | ||||||
|
|
||||||
| Keep `docs/advanced/input_files/input-main.md` in PRs that change INPUT | ||||||
| metadata. The YAML dump is intentionally transient so there is only one | ||||||
| generated reference file to maintain. | ||||||
|
|
||||||
| ## 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 -v "$PWD:/project" -w /project \ | ||||||
| readthedocs/build:ubuntu-22.04-2024.01.29 \ | ||||||
| /bin/bash -lc 'python -m pip install -r docs/requirements.txt sphinx ninja && | ||||||
| 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 && | ||||||
| export ABACUS_BINARY=./build-rtd-docs/source/abacus_pw_ser && | ||||||
| sphinx-build -b html docs /tmp/abacus-docs-html' | ||||||
| ``` | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better document generic
python3 venvhere. This is a general instruction and we can't assume someone a fan of specific Python manager.