Skip to content

Commit 1f34f99

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

2 files changed

Lines changed: 72 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: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 to build cuda.pathfinder docs
7+
# to mirror CI (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+
# - Installs cuda.pathfinder in editable mode so Sphinx can import it.
16+
17+
set -euo pipefail
18+
19+
ENV_NAME="cuda-python-docs"
20+
PYVER="3.12"
21+
22+
have_cmd() { command -v "$1" >/dev/null 2>&1; }
23+
24+
# --- sanity checks -----------------------------------------------------------
25+
if ! have_cmd conda; then
26+
echo "ERROR: 'conda' not found on PATH. Please ensure Miniforge is installed and initialized." >&2
27+
exit 1
28+
fi
29+
30+
# Load conda's shell integration into this bash process
31+
eval "$(conda shell.bash hook)"
32+
33+
# --- create/update environment ----------------------------------------------
34+
if conda env list | awk '{print $1}' | grep -qx "${ENV_NAME}"; then
35+
echo "⚠ Environment '${ENV_NAME}' already exists → NO ACTION"
36+
exit 0
37+
fi
38+
39+
echo "Creating environment '${ENV_NAME}'…"
40+
# ATTENTION: This dependency list is duplicated in
41+
# cuda_python/docs/environment-docs.yml. Please KEEP THEM IN SYNC!
42+
conda create -y -n "${ENV_NAME}" \
43+
"python=${PYVER}" \
44+
cython \
45+
myst-parser \
46+
numpy \
47+
numpydoc \
48+
pip \
49+
pydata-sphinx-theme \
50+
pytest \
51+
scipy \
52+
"sphinx<8.2.0" \
53+
sphinx-copybutton \
54+
myst-nb \
55+
enum_tools \
56+
sphinx-toolbox \
57+
pyclibrary
58+
59+
conda activate "${ENV_NAME}"
60+
python -m pip install --upgrade pip
61+
python -m pip install nvidia-sphinx-theme
62+
63+
echo
64+
echo "✅ Environment '${ENV_NAME}' is ready."
65+
echo
66+
echo "Build docs with e.g.:"
67+
echo " conda activate ${ENV_NAME}"
68+
echo " cd cuda_pathfinder/"
69+
echo " pip install -e ."
70+
echo " (cd docs/ && rm -rf build && ./build_docs.sh)"

0 commit comments

Comments
 (0)