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