Skip to content

Commit 1261b8a

Browse files
gigonySimoneBendazzoli93
authored andcommitted
Update readthedocs configuration
Signed-off-by: Gigon Bae <[email protected]> Signed-off-by: Simone Bendazzoli <[email protected]>
1 parent a3ff417 commit 1261b8a

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed

docs/source/conf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
f"{READTHEDOCS_PROJECT}/envs/{READTHEDOCS_VERSION}/bin/activate; ../../run setup read_the_docs'",
2020
shell=True,
2121
)
22-
# Print LD_LIBRARY_PATH for verification
23-
ld_library_path = os.environ.get("LD_LIBRARY_PATH", "")
24-
print(f"LD_LIBRARY_PATH: {ld_library_path}")
22+
# Update LD_LIBRARY_PATH for CUDA runtime
23+
old_ld_library_path = os.environ.get("LD_LIBRARY_PATH", "")
24+
# Note that 'python3.8' is hard-coded here, it should be updated if the Python version changes by
25+
# .readthedocs.yml or other configurations.
26+
os.environ["LD_LIBRARY_PATH"] = (
27+
f"{READTHEDOCS_PROJECT}/envs/{READTHEDOCS_VERSION}/lib/python3.8/site-packages/nvidia/cuda_runtime/lib:{old_ld_library_path}"
28+
)
2529
subprocess.call(
2630
"/bin/bash -c 'source /home/docs/checkouts/readthedocs.org/user_builds/"
2731
f"{READTHEDOCS_PROJECT}/envs/{READTHEDOCS_VERSION}/bin/activate; ../../run setup_gen_docs'",

run

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,12 @@ get_package_info() {
302302

303303
install_python_dev_deps() {
304304
local config="${1:-dev}"
305-
local is_read_the_docs="false"
306305
if [ -n "${VIRTUAL_ENV}" ] || [ -n "${CONDA_PREFIX}" ]; then
307306
# Read the Docs site is using specific setuptools version so should not upgrade it.
308307
if [ "$config" = "read_the_docs" ]; then
309-
is_read_the_docs="true"
308+
run_command ${MONAI_PY_EXE} -m pip install -q -U pip wheel build
309+
# Install cuda runtime dependency
310+
run_command ${MONAI_PY_EXE} -m pip install -q nvidia-cuda-runtime-cu12
310311
else
311312
run_command ${MONAI_PY_EXE} -m pip install -q -U setuptools pip wheel build
312313
fi
@@ -330,26 +331,6 @@ install_python_dev_deps() {
330331
# fix_holoscan_import
331332

332333
install_edit_mode
333-
334-
# Install packages overridden by Holoscan package if readthedocs is enabled
335-
if [ ${is_read_the_docs} = "true" ]; then
336-
# Upgrade pip overridden by Holoscan
337-
run_command ${MONAI_PY_EXE} -m pip install -q -U pip wheel build
338-
# Upgrade PyYAML to avoid the issue with the version installed by Holoscan
339-
run_command ${MONAI_PY_EXE} -m pip install -U PyYAML
340-
341-
# Install cuda runtime dependency
342-
run_command ${MONAI_PY_EXE} -m pip install nvidia-cuda-runtime-cu12
343-
344-
# Copy the cuda runtime library to the fixed location (workaround for readthedocs) so that
345-
# we can leverage the existing LD_LIBRARY_PATH (configured by the readthedocs UI) to locate the cuda runtime library.
346-
# (LD_LIBRARY_PATH is set to /home/docs/ for that purpose)
347-
# Note that 'python3.9' is hard-coded here, it should be updated if the Python version changes by
348-
# .readthedocs.yml or other configurations.
349-
run_command ls -al /home/docs/checkouts/readthedocs.org/user_builds/${READTHEDOCS_PROJECT}/envs/${READTHEDOCS_VERSION}/lib/python3.9/site-packages/nvidia/cuda_runtime/lib/
350-
run_command cp /home/docs/checkouts/readthedocs.org/user_builds/${READTHEDOCS_PROJECT}/envs/${READTHEDOCS_VERSION}/lib/python3.9/site-packages/nvidia/cuda_runtime/lib/*.so* /home/docs/
351-
run_command ls -al /home/docs/
352-
fi
353334
}
354335

355336
fix_holoscan_import() {
@@ -407,7 +388,7 @@ install_edit_mode() {
407388

408389
setup_desc() { c_echo 'Setup development environment
409390
410-
Arguments:
391+
Arguements:
411392
$1 - configuration (default: "dev")
412393
'
413394
}
@@ -468,7 +449,7 @@ build_desc() { c_echo 'Build distribution package
468449
Build a distribution package for this SDK using
469450
"build" (https://pypa-build.readthedocs.io/en/stable/index.html).
470451
471-
Arguments:
452+
Arguements:
472453
$1 - destination folder (default: ${TOP}/dist)
473454
'
474455
}
@@ -970,7 +951,7 @@ setup_gen_docs() {
970951

971952
gen_docs_desc() { c_echo 'Generate documents
972953
973-
Generated docs would be available at ${TOP}/dist/docs.
954+
Generated docs would be avaialable at ${TOP}/dist/docs.
974955
975956
Arguments:
976957
$1 - output folder path (html docs)
@@ -1012,7 +993,7 @@ gen_docs_dev_desc() { c_echo 'Generate documents (with dev-server)
1012993
1013994
Launch dev-server for sphinx.
1014995
1015-
Generated docs would be available at ${TOP}/dist/docs.
996+
Generated docs would be avaialable at ${TOP}/dist/docs.
1016997
1017998
Arguments:
1018999
-p <port> - port number

0 commit comments

Comments
 (0)