Skip to content

Commit a97918e

Browse files
committed
Add toolshed/setup-docs-env.sh
1 parent c08ce51 commit a97918e

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

cuda_python/docs/environment-docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ name: cuda-python-docs
55
channels:
66
- conda-forge
77
dependencies:
8+
# ATTENTION: This dependency list is duplicated in
9+
# toolshed/setup-docs-env.sh. Please KEEP THEM IN SYNC!
810
- cython
911
- myst-parser
1012
- numpy

toolshed/setup-docs-env.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
3+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Setup a local conda environment for building the sphinx docs to mirror the CI environment
7+
# (see cuda_python/docs/environment-docs.yml).
8+
#
9+
# Usage:
10+
# ./toolshed/setup-docs-env.sh
11+
#
12+
# Notes:
13+
# - Requires an existing Miniforge/Conda install and `conda` on PATH.
14+
# - Installs the same packages as CI’s environment-docs.yml.
15+
16+
set -euo pipefail
17+
18+
ENV_NAME="cuda-python-docs"
19+
PYVER="3.12"
20+
21+
have_cmd() { command -v "$1" >/dev/null 2>&1; }
22+
23+
# --- sanity checks -----------------------------------------------------------
24+
if ! have_cmd conda; then
25+
echo "ERROR: 'conda' not found on PATH. Please ensure Miniforge is installed and initialized." >&2
26+
exit 1
27+
fi
28+
29+
# Load conda's shell integration into this bash process
30+
eval "$(conda shell.bash hook)"
31+
32+
if conda env list | awk '{print $1}' | grep -qx "${ENV_NAME}"; then
33+
echo "⚠ Environment '${ENV_NAME}' already exists → NO ACTION"
34+
exit 0
35+
fi
36+
37+
echo "Creating environment '${ENV_NAME}'…"
38+
# ATTENTION: This dependency list is duplicated in
39+
# cuda_python/docs/environment-docs.yml. Please KEEP THEM IN SYNC!
40+
conda create -y -n "${ENV_NAME}" \
41+
"python=${PYVER}" \
42+
cython \
43+
myst-parser \
44+
numpy \
45+
numpydoc \
46+
pip \
47+
pydata-sphinx-theme \
48+
pytest \
49+
scipy \
50+
"sphinx<8.2.0" \
51+
sphinx-copybutton \
52+
myst-nb \
53+
enum_tools \
54+
sphinx-toolbox \
55+
pyclibrary
56+
57+
conda activate "${ENV_NAME}"
58+
python -m pip install --upgrade pip
59+
python -m pip install nvidia-sphinx-theme
60+
61+
echo
62+
echo "✅ Environment '${ENV_NAME}' is ready."
63+
echo
64+
echo "Build docs with e.g.:"
65+
echo " conda activate ${ENV_NAME}"
66+
echo " cd cuda_pathfinder/"
67+
echo " pip install -e ."
68+
echo " (cd docs/ && rm -rf build && ./build_docs.sh)"

0 commit comments

Comments
 (0)