Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++ API docs to documentation builds #414

Merged
29 commits merged into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
153bd49
First pass at Doxygen docs
dagardner-nv Oct 24, 2022
33ad0cf
Exclude nvtext and unittests:
dagardner-nv Oct 24, 2022
a8b1e00
Build docs in CI
dagardner-nv Oct 24, 2022
84ab858
WIP: working-ish
dagardner-nv Oct 25, 2022
5076419
Enable dot graphs
dagardner-nv Oct 25, 2022
5920086
Add C++ api to index
dagardner-nv Oct 25, 2022
6eaaa30
Move output to a subdir so that the output won't be intermixed with i…
dagardner-nv Oct 25, 2022
c7707cc
Update docs
dagardner-nv Oct 25, 2022
a237661
Build via cmake
dagardner-nv Oct 25, 2022
6387ded
Pin pytest to v 7.1 work-around for https://github.com/ionelmc/pytest…
dagardner-nv Oct 25, 2022
1a150da
Pin to v0.9.0 of camouflage
dagardner-nv Oct 25, 2022
b02833e
Revert "Pin pytest to v 7.1 work-around for https://github.com/ionelm…
dagardner-nv Oct 25, 2022
5d703b5
Revert "Pin to v0.9.0 of camouflage"
dagardner-nv Oct 25, 2022
0b5836c
Disable validation, causes problems with v0.10
dagardner-nv Oct 25, 2022
24d7f39
Pin camouflage-server to v0.9
dagardner-nv Oct 25, 2022
dc504e6
Ensure we are picking up pytest-benchmark >= 4
dagardner-nv Oct 25, 2022
67b146e
Move pytest-benchmark dep to requirements, fixes issue where conda do…
dagardner-nv Oct 25, 2022
8311382
Merge branch 'branch-22.11' into david-doxygen-pt2
dagardner-nv Oct 27, 2022
83ffd97
Merge branch 'branch-22.11' into david-doxygen-pt2
dagardner-nv Nov 7, 2022
29dccd9
Spelling mistake
dagardner-nv Nov 18, 2022
f300d3a
Merge branch 'david-doxygen-pt2' of github.com:dagardner-nv/Morpheus …
dagardner-nv Nov 18, 2022
1d4320a
Merge branch 'branch-23.01' into david-doxygen-pt2
dagardner-nv Dec 6, 2022
faaf3a3
Update docs/conda_docs.yml
dagardner-nv Dec 6, 2022
688e11e
Rename requirements
dagardner-nv Dec 6, 2022
3d5752f
Remove older doxygen configs
dagardner-nv Dec 7, 2022
a0201ec
Fix doxygen configs, exlcude external namespaces appearing in the output
dagardner-nv Dec 7, 2022
6f6cd85
Merge branch 'branch-23.01' into david-doxygen-pt2
dagardner-nv Dec 7, 2022
3baa656
Remove older doxygen target
dagardner-nv Dec 7, 2022
e91b7c5
Merge branch 'david-doxygen-pt2' of github.com:dagardner-nv/Morpheus …
dagardner-nv Dec 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ dask-worker-space
*.lock
triton_models/**/*.onnx
triton_models/**/*.engine
docs/source/_lib
docs/source/_modules
data/*
mlruns/*
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ option(MORPHEUS_USE_CLANG_TIDY "Enable running clang-tidy as part of the build p
option(MORPHEUS_USE_CONDA "Enables finding dependencies via conda instead of vcpkg.
Note: This will disable vcpkg. All dependencies must be installed first in the conda environment" OFF)
option(MORPHEUS_USE_IWYU "Enable running include-what-you-use as part of the build process" OFF)
option(MORPHEUS_BUILD_DOCS "Enable building of API documentation" OFF)
set(MORPHEUS_PY_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/wheel" CACHE STRING "Location to install the python directory")

set(MORPHEUS_CACHE_DIR "${CMAKE_SOURCE_DIR}/.cache" CACHE PATH "Directory to contain all CPM and CCache data")
Expand Down Expand Up @@ -100,6 +101,10 @@ if(MORPHEUS_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

if(MORPHEUS_BUILD_DOCS)
add_subdirectory(docs)
endif()

# Get all of the python files to copy to the build directory
file(GLOB_RECURSE MORPHEUS_PYTHON_FILES
RELATIVE ${PROJECT_SOURCE_DIR}
Expand Down
13 changes: 7 additions & 6 deletions ci/scripts/github/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ cd ${MORPHEUS_ROOT}
git lfs install
${MORPHEUS_ROOT}/scripts/fetch_data.py fetch docs

cd ${MORPHEUS_ROOT}/docs
rapids-logger "Installing Documentation dependencies"
pip install -r requirement.txt
mamba env update -f ${MORPHEUS_ROOT}/docs/conda_docs.yml

rapids-logger "Building docs"
rapids-logger "Configuring for docs"
cmake -B build -G Ninja ${CMAKE_BUILD_ALL_FEATURES} -DMORPHEUS_BUILD_DOCS=ON .

make -j ${PARALLEL_LEVEL} html
rapids-logger "Building docs"
cmake --build build --target morpheus_docs

rapids-logger "Tarring the docs"
tar cfj "${WORKSPACE_TMP}/docs.tar.bz" build/html
rapids-logger "Archiving the docs"
tar cfj "${WORKSPACE_TMP}/docs.tar.bz" build/docs/html

rapids-logger "Pushing results to ${DISPLAY_ARTIFACT_URL}"
aws s3 cp --no-progress "${WORKSPACE_TMP}/docs.tar.bz" "${ARTIFACT_URL}/docs.tar.bz"
Expand Down
29 changes: 29 additions & 0 deletions cmake/FindSphinx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

# Based on example in:
# https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/

#Look for an executable called sphinx-build
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable")

include(FindPackageHandleStandardArgs)

#Handle standard arguments to find_package like REQUIRED and QUIET
find_package_handle_standard_args(Sphinx
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE)
1 change: 1 addition & 0 deletions docker/conda/environments/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Packages listed here should also be listed in setup.py
git+https://github.com/nv-morpheus/dfencoder.git@branch-22.09#egg=dfencoder
nvidia-pyindex
pytest-benchmark>=4.0
torch==1.10.2+cu113
tritonclient[all]==2.17.*
websockets
32 changes: 32 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

list(APPEND CMAKE_MESSAGE_CONTEXT "docs")

find_package(Doxygen REQUIRED dot doxygen)
find_package(Sphinx REQUIRED)

set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/source)
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/html)

add_custom_target(${PROJECT_NAME}_docs ALL
COMMAND
BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}
${SPHINX_EXECUTABLE} -b html -j auto -T
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Sphinx")

list(POP_BACK CMAKE_MESSAGE_CONTEXT)
39 changes: 0 additions & 39 deletions docs/Makefile

This file was deleted.

24 changes: 11 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!--
SPDX-FileCopyrightText: Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -17,19 +17,17 @@

# Building Documentation

A basic python environment with packages listed in `./requirement.txt` is
enough to build the docs.
Additional packages required for building the documentation are defined in `./conda_docs.yml`.

## Get additional dependency

From the roof of the morpheus repo:
```bash
pip install -r requirement.txt
mamba env update -f docs/conda_docs.yml
```

## Run makefile:

```bash
make html
## To build the documentation run:
```

Outputs to `build/html/index.html`
cmake -B build -DMORPHEUS_BUILD_DOCS=ON .
cmake --build build --target morpheus_docs
```
Outputs to `build/docs/html`
25 changes: 25 additions & 0 deletions docs/conda_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: morpheus
channels:
- conda-forge
dependencies:
- doxygen=1.9.2
- pip
####### Morpheus Pip Dependencies (keep sorted!) #######
- pip:
# Ensure all runtime requirements are installed using the requirements file
- --requirement requirement.txt
51 changes: 0 additions & 51 deletions docs/make.bat

This file was deleted.

2 changes: 2 additions & 0 deletions docs/requirement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

breathe==4.34.0
exhale==0.3.6
ipython
myst-parser==0.17.2
nbsphinx
Expand Down
11 changes: 4 additions & 7 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
API Reference
=============

This page contains the list of project's modules.
.. toctree::
:maxdepth: 3

.. autosummary::
:toctree: _modules
:template: custom-module-template.rst
:recursive:

morpheus
py_api
_lib/index
46 changes: 43 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import importlib
import os
import sys
import textwrap

import packaging

Expand Down Expand Up @@ -71,18 +72,57 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"IPython.sphinxext.ipython_console_highlighting",
"IPython.sphinxext.ipython_directive",
'breathe',
'exhale',
'IPython.sphinxext.ipython_console_highlighting',
'IPython.sphinxext.ipython_directive',
'myst_parser',
"nbsphinx",
'nbsphinx',
'numpydoc',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.graphviz',
'sphinx.ext.intersphinx',
'sphinx.ext.linkcode',
]

# Breathe Configuration
breathe_default_project = "morpheus"

# This will be set when invoked by cmake
build_dir = os.environ.get('BUILD_DIR', './')
doxygen_tmp_dir = os.path.join(build_dir, "_doxygen/xml")
breathe_projects = {"morpheus": doxygen_tmp_dir}

exhale_args = {
"containmentFolder":
"./_lib",
"rootFileName":
"index.rst",
"doxygenStripFromPath":
"../../",
"rootFileTitle":
"C++ API",
"createTreeView":
True,
"exhaleExecutesDoxygen":
True,
"exhaleDoxygenStdin":
textwrap.dedent('''
INPUT = ../../morpheus/_lib
FILE_PATTERNS = *.c *.cc *.cpp *.h *.hpp *.cu *.cuh *.md
EXCLUDE_PATTERNS = */tests/* */include/nvtext/* */__pycache__/*
SOURCE_BROWSER = YES
EXTENSION_MAPPING = cu=C++ cuh=C++
BRIEF_MEMBER_DESC = YES
HIDE_UNDOC_MEMBERS = NO
HAVE_DOT = YES
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
''')
}

# Include Python objects as they appear in source files
# Default: alphabetically ('alphabetical')
# autodoc_member_order = 'groupwise'
Expand Down
Loading