Skip to content

Commit 182aede

Browse files
Merge pull request #1619 from IntelPython/docstring-edits
Overhaul of dpctl documentation
2 parents fad4b77 + 1abd650 commit 182aede

File tree

81 files changed

+4293
-40
lines changed

Some content is hidden

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

81 files changed

+4293
-40
lines changed

.github/workflows/generate-docs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ jobs:
5454
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
5555
shell: bash -l {0}
5656
run: |
57-
pip install numpy cython setuptools scikit-build cmake sphinx"<7.2" sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics
57+
pip install numpy cython setuptools scikit-build cmake sphinx"<7.2" pydot graphviz furo \
58+
sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx-design \
59+
sphinxcontrib-jsmath sphinx-copybutton sphinxcontrib-spelling
5860
- name: Checkout repo
5961
uses: actions/[email protected]
6062
with:
@@ -74,12 +76,15 @@ jobs:
7476
-DCMAKE_CXX_COMPILER:PATH=$(which icpx) \
7577
-DDPCTL_GENERATE_DOCS=ON \
7678
-DDPCTL_ENABLE_DOXYREST=ON \
77-
-DDoxyrest_DIR=`pwd`/doxyrest-2.1.2-linux-amd64
79+
-DDoxyrest_DIR=`pwd`/doxyrest-2.1.2-linux-amd64 \
80+
-DCMAKE_VERBOSE_MAKEFILE=ON
7881
python -c "import dpctl; print(dpctl.__version__)" || exit 1
79-
cd "$(find _skbuild -name cmake-build)" || exit 1
82+
pushd "$(find _skbuild -name cmake-build)" || exit 1
8083
cmake --build . --target Sphinx || exit 1
8184
mv ../cmake-install/docs/docs ~/docs
8285
git clean -dfx
86+
popd
87+
git reset --hard
8388
- name: Publish docs
8489
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.ref == 'refs/heads/master' && github.event.action != 'closed' }}
8590
shell: bash -l {0}

docs/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ docfiles/libsyclinterface
44
docfiles/dpctl
55
api
66
build
7-
conf.py
8-
index.rst
97
doxyrest-config.lua
8+
doc_sources/api_reference/dpctl/generated
9+
doc_sources/api_reference/libsyclinterface/generated

docs/CMakeLists.txt

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,22 @@ function(_setup_doxygen)
5757
endfunction()
5858

5959
function(_setup_doxyrest)
60-
set(DOXYREST_OUTPUT_DIR_NAME docfiles/libsyclinterface)
60+
set(DOXYREST_OUTPUT_RELATIVE_DIR_NAME doc_sources/api_reference/libsyclinterface/generated)
6161
# Set the DOXYREST_OUTPUT_DIR variable in both current and parent scope.
6262
# The variable is used by _setup_sphinx when generating the conf.py file.
6363
set(DOXYREST_OUTPUT_DIR
64-
${CMAKE_CURRENT_SOURCE_DIR}/${DOXYREST_OUTPUT_DIR_NAME}
64+
${CMAKE_CURRENT_SOURCE_DIR}/${DOXYREST_OUTPUT_RELATIVE_DIR_NAME}
6565
PARENT_SCOPE
6666
)
6767
set(DOXYREST_OUTPUT_DIR
68-
${CMAKE_CURRENT_SOURCE_DIR}/${DOXYREST_OUTPUT_DIR_NAME}
68+
${CMAKE_CURRENT_SOURCE_DIR}/${DOXYREST_OUTPUT_RELATIVE_DIR_NAME}
6969
)
7070
set(DOXYREST_CONFIG_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxyrest-config.lua.in)
7171
set(DOXYREST_CONFIG_OUT ${CMAKE_CURRENT_SOURCE_DIR}/doxyrest-config.lua)
7272
set(DOXYREST_OUTPUT ${DOXYREST_OUTPUT_DIR}/index.rst)
7373
set(DOXYGEN_OUTPUT_DIR ${DOC_OUTPUT_DIR}/doxygen)
7474

7575
configure_file(${DOXYREST_CONFIG_IN} ${DOXYREST_CONFIG_OUT} @ONLY)
76-
configure_file(${INDEX_DOXYREST_IN} ${INDEX_OUT} @ONLY)
7776

7877
add_custom_command(
7978
OUTPUT ${DOXYREST_OUTPUT}
@@ -83,7 +82,6 @@ function(_setup_doxyrest)
8382
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
8483
DEPENDS
8584
# Other docs files that can be edited manually
86-
${INDEX_OUT}
8785
${DOXYGEN_INDEX_FILE}
8886
MAIN_DEPENDENCY ${DOXYREST_CONFIG_OUT} ${DOXYREST_CONFIG_IN}
8987
COMMENT "Generating Doxyrest documentation"
@@ -96,46 +94,27 @@ function(_setup_doxyrest)
9694
endfunction()
9795

9896
function(_setup_sphinx)
99-
set(GENERATE_RST_OUTPUT_DIR
100-
${CMAKE_CURRENT_SOURCE_DIR}/docfiles/dpctl
101-
)
102-
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
97+
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/doc_sources)
10398
set(SPHINX_OUTPUT_DIR ${DOC_OUTPUT_DIR}/docs)
10499
set(SPHINX_INDEX_FILE ${SPHINX_OUTPUT_DIR}/index.html)
105-
set(SPHINX_CONF_IN ${SPHINX_SOURCE}/conf.in)
100+
101+
set(SPHINX_CONF_IN ${SPHINX_SOURCE}/conf.py.in)
106102
set(SPHINX_CONF_OUT ${SPHINX_SOURCE}/conf.py)
107-
set(DPCTL_PYAPI_RST_FILE ${GENERATE_RST_OUTPUT_DIR}/dpctl_pyapi.rst)
108103

109104
if(DPCTL_ENABLE_DOXYREST)
110105
set(DEPEND_ON_DOXYREST "Doxyrest")
111106
else()
112-
configure_file(${INDEX_NO_DOXYREST_IN} ${INDEX_OUT} @ONLY)
107+
set(_generated_dir ${SPHINX_SOURCE}/api_reference/libsyclinterface/generated)
108+
configure_file(${_generated_dir}/index_template.rst.in ${_generated_dir}/index.rst @ONLY)
113109
endif()
114110

115-
configure_file(
116-
"${CMAKE_CURRENT_SOURCE_DIR}/generate_rst.py"
117-
${CMAKE_CURRENT_BINARY_DIR}
118-
)
119-
# A custom command to generate the Python API rst files
120-
add_custom_command(
121-
OUTPUT ${DPCTL_PYAPI_RST_FILE}
122-
COMMAND ${CMAKE_COMMAND} -E make_directory ${GENERATE_RST_OUTPUT_DIR}
123-
COMMAND
124-
"${Python_EXECUTABLE}"
125-
"${CMAKE_CURRENT_BINARY_DIR}/generate_rst.py"
126-
--dir "${GENERATE_RST_OUTPUT_DIR}"
127-
--module "dpctl"
128-
COMMENT "Generating RST files for Python API of dpctl"
129-
)
130111
add_custom_command(
131112
OUTPUT ${SPHINX_INDEX_FILE}
132113
COMMAND
133114
${SPHINX_EXECUTABLE} -b html
134115
${SPHINX_SOURCE}
135116
${SPHINX_OUTPUT_DIR}
136117
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
137-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/index.rst
138-
MAIN_DEPENDENCY ${SPHINX_CONF_OUT} ${SPHINX_CONF_IN}
139118
COMMENT "Generating Sphinx documentation"
140119
)
141120
# Target to generate Sphinx. Note that the order of the dependencies is
@@ -144,7 +123,6 @@ function(_setup_sphinx)
144123
Sphinx
145124
DEPENDS
146125
${DEPEND_ON_DOXYREST}
147-
${DPCTL_PYAPI_RST_FILE}
148126
${SPHINX_INDEX_FILE}
149127
)
150128
# Create a conf.py by replacing variables inside @@ with the current values
@@ -192,8 +170,8 @@ endif()
192170
# Set the location where the generated docs are saved
193171
set(DOC_OUTPUT_DIR ${CMAKE_INSTALL_PREFIX}/docs)
194172

195-
set(INDEX_NO_DOXYREST_IN ${CMAKE_CURRENT_SOURCE_DIR}/index_no_doxyrest.rst.in)
196-
set(INDEX_DOXYREST_IN ${CMAKE_CURRENT_SOURCE_DIR}/index_doxyrest.rst.in)
173+
# set(INDEX_NO_DOXYREST_IN ${CMAKE_CURRENT_SOURCE_DIR}/index_no_doxyrest.rst.in)
174+
# set(INDEX_DOXYREST_IN ${CMAKE_CURRENT_SOURCE_DIR}/index_doxyrest.rst.in)
197175
set(INDEX_OUT ${CMAKE_CURRENT_SOURCE_DIR}/index.rst)
198176

199177
_set_current_release()
@@ -207,6 +185,6 @@ set_property(
207185
DIRECTORY
208186
PROPERTY
209187
ADDITIONAL_CLEAN_FILES
210-
"${CMAKE_CURRENT_SOURCE_DIR}/docfiles/dpctl"
211-
"${CMAKE_CURRENT_SOURCE_DIR}/docfiles/libsyclinterface"
188+
"${CMAKE_CURRENT_SOURCE_DIR}/doc_sources/api_reference/dpctl/generated"
189+
"${CMAKE_CURRENT_SOURCE_DIR}/doc_sources/api_reference/libsyclinterface/generated"
212190
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)