Skip to content

Commit 547a413

Browse files
authored
[Docs] Convert Sphinx docs to Fern (#2067)
This PR converts the current Sphinx docs to Fern in preparation for the move to docs.nvidia.com. Instead of manually composing the API reference docs, this PR also generates API reference docs for all supported languages directly from the code (as is standard in Fern). There's a lot of files in this PR, and most of the markdown files are either copied over to the Fern directory format from the old Sphinx docs, or they've been auto-generated using the new API reference docs generation scripts (`generate_api_reference.py` in the changes). When reviewing this PR, it's probably better to start with the non-markdown files, then build the docs and run them locally. The docs can be built in the usual way with `./build.sh docs`. You can run them locally using the following command: ``` fern/build_docs.sh dev --port 3000 --backend-port 3001 ``` Authors: - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Bradley Dice (https://github.com/bdice) - Divye Gala (https://github.com/divyegala) - Robert Maynard (https://github.com/robertmaynard) URL: #2067
1 parent 48ce027 commit 547a413

365 files changed

Lines changed: 58202 additions & 7709 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ examples/rust/ @rapidsai/cuvs-rust-codeowners
2020

2121
#docs code owners
2222
docs/ @rapidsai/cuvs-docs-codeowners
23+
fern/ @rapidsai/cuvs-docs-codeowners
2324

2425
#cmake code owners
2526
CMakeLists.txt @rapidsai/cuvs-cmake-codeowners

.github/workflows/build.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ jobs:
229229
uses: ./.github/workflows/publish-rust.yaml
230230
docs-build:
231231
if: github.ref_type == 'branch'
232-
needs: python-build
233232
permissions:
234233
actions: read
235234
contents: read

.github/workflows/check-c-abi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ jobs:
128128
- The changes are documented in the changelog
129129
- Migration guide is provided for users
130130
131-
For more information, see the [C ABI documentation](../docs/source/c_developer_guide.md).`
131+
For more information, see the [C API documentation](../fern/pages/c_api/index.md).`
132132
});

.github/workflows/pr.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ jobs:
134134
- '!ci/test_wheel_cuvs.sh'
135135
- '!ci/validate_wheel.sh'
136136
- '!docs/**'
137+
- '!fern/**'
137138
- '!go/**'
138139
- '!img/**'
139140
- '!java/**'
@@ -170,6 +171,7 @@ jobs:
170171
- '!ci/validate_wheel.sh'
171172
- '!Dockerfile'
172173
- '!docs/**'
174+
- '!fern/**'
173175
- '!img/**'
174176
- '!notebooks/**'
175177
- '!python/**'
@@ -209,6 +211,7 @@ jobs:
209211
- '!Dockerfile'
210212
- '!README.md'
211213
- '!docs/**'
214+
- '!fern/**'
212215
- '!go/**'
213216
- '!img/**'
214217
- '!java/**'
@@ -253,6 +256,7 @@ jobs:
253256
- '!cpp/.clang-tidy'
254257
- '!cpp/doxygen/**'
255258
- '!docs/**'
259+
- '!fern/**'
256260
- '!java/**'
257261
- '!go/**'
258262
- '!img/**'
@@ -292,6 +296,7 @@ jobs:
292296
- '!ci/test_wheel_cuvs.sh'
293297
- '!ci/validate_wheel.sh'
294298
- '!docs/**'
299+
- '!fern/**'
295300
- '!go/**'
296301
- '!img/**'
297302
- '!java/**'
@@ -332,6 +337,7 @@ jobs:
332337
- '!ci/test_wheel_cuvs.sh'
333338
- '!ci/validate_wheel.sh'
334339
- '!docs/**'
340+
- '!fern/**'
335341
- '!img/**'
336342
- '!java/**'
337343
- '!notebooks/**'
@@ -581,7 +587,6 @@ jobs:
581587
container_image: "rapidsai/ci-conda:26.06-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
582588
script: "ci/build_go.sh"
583589
docs-build:
584-
needs: conda-python-build
585590
permissions:
586591
actions: read
587592
contents: read

build.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ HELP="$0 [<target> ...] [<flag> ...] [--cmake-args=\"<args>\"] [--cache-tool=<to
6767
default action (no args) is to build libcuvs, tests and cuvs targets
6868
"
6969
LIBCUVS_BUILD_DIR=${LIBCUVS_BUILD_DIR:=${REPODIR}/cpp/build}
70-
SPHINX_BUILD_DIR=${REPODIR}/docs
71-
DOXYGEN_BUILD_DIR=${REPODIR}/cpp/doxygen
70+
FERN_DOCS_DIR=${REPODIR}/fern
7271
PYTHON_BUILD_DIR=${REPODIR}/python/cuvs/_skbuild
7372
RUST_BUILD_DIR=${REPODIR}/rust/target
7473
JAVA_BUILD_DIR=${REPODIR}/java/cuvs-java/target
@@ -99,7 +98,9 @@ EXTRA_CMAKE_ARGS=""
9998

10099
# Set defaults for vars that may not have been defined externally
101100
INSTALL_PREFIX=${INSTALL_PREFIX:=${PREFIX:=${CONDA_PREFIX:=$LIBCUVS_BUILD_DIR/install}}}
102-
PARALLEL_LEVEL=${PARALLEL_LEVEL:=$(nproc)}
101+
if [[ -z "${PARALLEL_LEVEL:-}" ]]; then
102+
PARALLEL_LEVEL=$(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc)
103+
fi
103104
BUILD_ABI=${BUILD_ABI:=ON}
104105

105106
# Default to Ninja if generator is not specified
@@ -371,7 +372,7 @@ fi
371372

372373
################################################################################
373374
# Configure for building all C++ targets
374-
if (( NUMARGS == 0 )) || hasArg libcuvs || hasArg docs || hasArg tests || hasArg bench-prims || hasArg bench-ann || hasArg examples; then
375+
if (( NUMARGS == 0 )) || hasArg libcuvs || hasArg tests || hasArg bench-prims || hasArg bench-ann || hasArg examples; then
375376
COMPILE_LIBRARY=ON
376377
if [[ "${BUILD_SHARED_LIBS}" != "OFF" ]]; then
377378
CMAKE_TARGET+=("cuvs")
@@ -535,13 +536,8 @@ export RAPIDS_VERSION_MAJOR_MINOR
535536

536537
if hasArg docs; then
537538
set -x
538-
cd "${DOXYGEN_BUILD_DIR}"
539-
doxygen Doxyfile
540-
cd "${SPHINX_BUILD_DIR}"
541-
make html
542-
cd "${REPODIR}"/rust
543-
cargo doc -p cuvs --no-deps
544-
rsync -av "${RUST_BUILD_DIR}"/doc/ "${SPHINX_BUILD_DIR}"/build/html/_static/rust
539+
cd "${REPODIR}"
540+
"${FERN_DOCS_DIR}/build_docs.sh" "${FERN_DOCS_MODE:-check}"
545541
fi
546542

547543
################################################################################

ci/build_docs.sh

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,16 @@
44

55
set -euo pipefail
66

7-
rapids-logger "Downloading artifacts from previous jobs"
8-
CPP_CHANNEL=$(rapids-download-conda-from-github cpp)
9-
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-package-name "conda_python" cuvs --stable --cuda "$RAPIDS_CUDA_VERSION")")
10-
11-
rapids-logger "Create test conda environment"
7+
rapids-logger "Create docs conda environment"
128
. /opt/conda/etc/profile.d/conda.sh
139

1410
rapids-logger "Configuring conda strict channel priority"
1511
conda config --set channel_priority strict
1612

17-
RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)"
18-
export RAPIDS_VERSION_MAJOR_MINOR
19-
2013
rapids-dependency-file-generator \
2114
--output conda \
2215
--file-key docs \
2316
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" \
24-
--prepend-channel "${CPP_CHANNEL}" \
25-
--prepend-channel "${PYTHON_CHANNEL}" \
2617
| tee env.yaml
2718

2819
rapids-mamba-retry env create --yes -f env.yaml -n docs
@@ -35,27 +26,40 @@ set -eu
3526

3627
rapids-print-env
3728

38-
RAPIDS_DOCS_DIR="$(mktemp -d)"
39-
export RAPIDS_DOCS_DIR
40-
41-
rapids-logger "Build CPP docs"
42-
pushd cpp/doxygen
43-
doxygen Doxyfile
44-
popd
45-
46-
rapids-logger "Build Rust docs"
47-
pushd rust
48-
LIBCLANG_PATH=$(dirname "$(find "$CONDA_PREFIX" -name libclang.so | head -n 1)")
49-
export LIBCLANG_PATH
50-
cargo doc -p cuvs --no-deps
51-
popd
52-
53-
rapids-logger "Build Python docs"
54-
pushd docs
55-
make dirhtml
56-
mv ../rust/target/doc ./build/dirhtml/_static/rust
57-
mkdir -p "${RAPIDS_DOCS_DIR}/cuvs/"html
58-
mv build/dirhtml/* "${RAPIDS_DOCS_DIR}/cuvs/html"
59-
popd
60-
61-
RAPIDS_VERSION_NUMBER="${RAPIDS_VERSION_MAJOR_MINOR}" rapids-upload-docs
29+
rapids-logger "Validate Fern docs"
30+
31+
find_pr_number() {
32+
local ref
33+
for ref in "${RAPIDS_REF_NAME:-}" "${GITHUB_REF:-}" "${GITHUB_REF_NAME:-}"; do
34+
if [[ "${ref}" =~ (^|/)pull-request/([0-9]+)$ ]]; then
35+
echo "${BASH_REMATCH[2]}"
36+
return 0
37+
fi
38+
if [[ "${ref}" =~ ^refs/pull/([0-9]+)/ ]]; then
39+
echo "${BASH_REMATCH[1]}"
40+
return 0
41+
fi
42+
if [[ "${ref}" =~ ^([0-9]+)/merge$ ]]; then
43+
echo "${BASH_REMATCH[1]}"
44+
return 0
45+
fi
46+
done
47+
}
48+
49+
FERN_DOCS_MODE="${FERN_DOCS_MODE:-check}"
50+
FERN_DOCS_ARGS=()
51+
52+
if [[ "${FERN_DOCS_MODE}" == "preview" ]]; then
53+
FERN_PREVIEW_ID="${FERN_DOCS_PREVIEW_ID:-}"
54+
if [[ -z "${FERN_PREVIEW_ID}" ]]; then
55+
PR_NUMBER="$(find_pr_number || true)"
56+
if [[ -n "${PR_NUMBER}" ]]; then
57+
FERN_PREVIEW_ID="pr-${PR_NUMBER}"
58+
fi
59+
fi
60+
if [[ -n "${FERN_PREVIEW_ID}" ]]; then
61+
FERN_DOCS_ARGS+=(--id "${FERN_PREVIEW_ID}")
62+
fi
63+
fi
64+
65+
fern/build_docs.sh "${FERN_DOCS_MODE}" "${FERN_DOCS_ARGS[@]}"

ci/release/update-version.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ if [[ "${RUN_CONTEXT}" == "main" ]]; then
139139
:
140140
elif [[ "${RUN_CONTEXT}" == "release" ]]; then
141141
# In release context, use release branch for documentation links (word boundaries to avoid partial matches)
142-
sed_runner "/rapidsai\\/cuvs/ s|\\bmain\\b|release/${NEXT_SHORT_TAG}|g" docs/source/developer_guide.md
142+
sed_runner "/rapidsai\\/cuvs/ s|\\bmain\\b|release/${NEXT_SHORT_TAG}|g" fern/pages/developer_guide.md
143143
sed_runner "s|\\bmain\\b|release/${NEXT_SHORT_TAG}|g" README.md
144144
# Only update the GitHub URL, not the main() function
145145
sed_runner "s|/cuvs/blob/\\bmain\\b/|/cuvs/blob/release/${NEXT_SHORT_TAG}/|g" python/cuvs_bench/cuvs_bench/plot/__main__.py
146146
fi
147147

148148
# Update cuvs-bench Docker image references (version-only, not branch-related)
149-
sed_runner "s|rapidsai/cuvs-bench:[0-9][0-9].[0-9][0-9]|rapidsai/cuvs-bench:${NEXT_SHORT_TAG}|g" docs/source/cuvs_bench/index.rst
149+
sed_runner "s|rapidsai/cuvs-bench:[0-9][0-9].[0-9][0-9]|rapidsai/cuvs-bench:${NEXT_SHORT_TAG}|g" fern/pages/cuvs_bench/index.md
150150

151151
# Version references (not branch-related)
152152
sed_runner "s|=[0-9][0-9].[0-9][0-9]|=${NEXT_SHORT_TAG}|g" README.md

conda/environments/all_cuda-129_arch-aarch64.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- _go_select *=cgo
9-
- breathe>=4.35.0
109
- c-compiler
1110
- clang-tools==20.1.8
1211
- clang==20.1.8
@@ -21,11 +20,8 @@ dependencies:
2120
- cxx-compiler
2221
- cython>=3.2.2
2322
- dlpack>=0.8,<1.0
24-
- doxygen>=1.8.20
2523
- gcc_linux-aarch64=14.*
2624
- go
27-
- graphviz
28-
- ipython
2925
- libclang==20.1.8
3026
- libcublas-dev
3127
- libcurand-dev
@@ -37,22 +33,16 @@ dependencies:
3733
- make
3834
- nccl>=2.19
3935
- ninja
36+
- nodejs>=22
4037
- numpy>=1.23,<3.0
41-
- numpydoc
4238
- openblas
4339
- pre-commit
4440
- pylibraft==26.6.*,>=0.0.0a0
4541
- pytest
4642
- pytest-cov
4743
- rapids-build-backend>=0.4.0,<0.5.0
48-
- recommonmark
4944
- rust
5045
- scikit-build-core>=0.11.0
5146
- scikit-learn>=1.5
52-
- sphinx-copybutton
53-
- sphinx-markdown-tables
54-
- sphinx>=8.0.0
5547
- sysroot_linux-aarch64==2.28
56-
- pip:
57-
- nvidia-sphinx-theme
5848
name: all_cuda-129_arch-aarch64

conda/environments/all_cuda-129_arch-x86_64.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- _go_select *=cgo
9-
- breathe>=4.35.0
109
- c-compiler
1110
- clang-tools==20.1.8
1211
- clang==20.1.8
@@ -21,11 +20,8 @@ dependencies:
2120
- cxx-compiler
2221
- cython>=3.2.2
2322
- dlpack>=0.8,<1.0
24-
- doxygen>=1.8.20
2523
- gcc_linux-64=14.*
2624
- go
27-
- graphviz
28-
- ipython
2925
- libclang==20.1.8
3026
- libcublas-dev
3127
- libcurand-dev
@@ -36,22 +32,16 @@ dependencies:
3632
- make
3733
- nccl>=2.19
3834
- ninja
35+
- nodejs>=22
3936
- numpy>=1.23,<3.0
40-
- numpydoc
4137
- openblas
4238
- pre-commit
4339
- pylibraft==26.6.*,>=0.0.0a0
4440
- pytest
4541
- pytest-cov
4642
- rapids-build-backend>=0.4.0,<0.5.0
47-
- recommonmark
4843
- rust
4944
- scikit-build-core>=0.11.0
5045
- scikit-learn>=1.5
51-
- sphinx-copybutton
52-
- sphinx-markdown-tables
53-
- sphinx>=8.0.0
5446
- sysroot_linux-64==2.28
55-
- pip:
56-
- nvidia-sphinx-theme
5747
name: all_cuda-129_arch-x86_64

conda/environments/all_cuda-132_arch-aarch64.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ channels:
66
- conda-forge
77
dependencies:
88
- _go_select *=cgo
9-
- breathe>=4.35.0
109
- c-compiler
1110
- clang-tools==20.1.8
1211
- clang==20.1.8
@@ -21,11 +20,8 @@ dependencies:
2120
- cxx-compiler
2221
- cython>=3.2.2
2322
- dlpack>=0.8,<1.0
24-
- doxygen>=1.8.20
2523
- gcc_linux-aarch64=14.*
2624
- go
27-
- graphviz
28-
- ipython
2925
- libclang==20.1.8
3026
- libcublas-dev
3127
- libcurand-dev
@@ -37,22 +33,16 @@ dependencies:
3733
- make
3834
- nccl>=2.19
3935
- ninja
36+
- nodejs>=22
4037
- numpy>=1.23,<3.0
41-
- numpydoc
4238
- openblas
4339
- pre-commit
4440
- pylibraft==26.6.*,>=0.0.0a0
4541
- pytest
4642
- pytest-cov
4743
- rapids-build-backend>=0.4.0,<0.5.0
48-
- recommonmark
4944
- rust
5045
- scikit-build-core>=0.11.0
5146
- scikit-learn>=1.5
52-
- sphinx-copybutton
53-
- sphinx-markdown-tables
54-
- sphinx>=8.0.0
5547
- sysroot_linux-aarch64==2.28
56-
- pip:
57-
- nvidia-sphinx-theme
5848
name: all_cuda-132_arch-aarch64

0 commit comments

Comments
 (0)