Skip to content

Commit

Permalink
CI driven github pages with sphinx docs for api reference (NVIDIA#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdye64 authored Feb 19, 2025
1 parent deb225a commit 6b872bb
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 6 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ jobs:
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
# Builds docs site
- name: Build docs site
- name: Build Sphinx API Docs
run: |
mkdocs build --config-file docs/mkdocs.yml
cd docs/sphinx_docs
make html
cd ../../
mv docs/sphinx_docs/build/html docs/docs/user-guide/api_docs
- name: Build MkDocs Site
run: mkdocs build --config-file docs/mkdocs.yml

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
Empty file removed api/src/__init__.py
Empty file.
1 change: 1 addition & 0 deletions docs/docs/user-guide/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
- [Quickstart](quickstart-guide.md)
- [Developer Guide](developer-guide/)
- [Contributing](contributing.md)
- [API Reference](api_docs/)
- [Release Notes](releasenotes-nv-ingest.md)
10 changes: 7 additions & 3 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site_name: MyLibrary Documentation
site_name: NV-Ingest Documentation
# site_url:
# repo_url:
repo_url: https://github.com/NVIDIA/nv-ingest
# repo_name:

theme:
Expand Down Expand Up @@ -57,8 +57,12 @@ plugins:
- mkdocstrings:
handlers:
python:
options:
docstring_style: google
show_source: true
show_if_no_docstring: true
paths:
- ../sub-packages/*/src
- ../api/*/src/nv_ingest_api
- mkdocs-jupyter:
theme: auto
highlight_extra_classes: "jupyter-notebook"
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ mkdocs-jupyter
mkdocs-include-dir-to-nav
mkdocs-literate-nav
mkdocs-site-urls
sphinx
sphinx-rtd-theme
20 changes: 20 additions & 0 deletions docs/sphinx_docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/sphinx_docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
33 changes: 33 additions & 0 deletions docs/sphinx_docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES.
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import os
import sys

sys.path.insert(0, os.path.abspath("../../../api/src")) # nv-ingest-api src

project = "nv-ingest"
copyright = "2025, Nvidia"
author = "Nvidia"
release = "24.12"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]

templates_path = ["_templates"]
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]
10 changes: 10 additions & 0 deletions docs/sphinx_docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NV-Ingest documentation
=======================

Add a welcome message here .....

.. toctree::
:maxdepth: 2
:caption: Contents:

user_guide/index
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nv\_ingest\_api.primitives.control\_message\_task.ControlMessageTask
====================================================================

.. currentmodule:: nv_ingest_api.primitives.control_message_task

.. autoclass:: ControlMessageTask


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~ControlMessageTask.__init__
~ControlMessageTask.construct
~ControlMessageTask.copy
~ControlMessageTask.dict
~ControlMessageTask.from_orm
~ControlMessageTask.json
~ControlMessageTask.model_construct
~ControlMessageTask.model_copy
~ControlMessageTask.model_dump
~ControlMessageTask.model_dump_json
~ControlMessageTask.model_json_schema
~ControlMessageTask.model_parametrized_name
~ControlMessageTask.model_post_init
~ControlMessageTask.model_rebuild
~ControlMessageTask.model_validate
~ControlMessageTask.model_validate_json
~ControlMessageTask.model_validate_strings
~ControlMessageTask.parse_file
~ControlMessageTask.parse_obj
~ControlMessageTask.parse_raw
~ControlMessageTask.schema
~ControlMessageTask.schema_json
~ControlMessageTask.update_forward_refs
~ControlMessageTask.validate





.. rubric:: Attributes

.. autosummary::

~ControlMessageTask.model_computed_fields
~ControlMessageTask.model_config
~ControlMessageTask.model_extra
~ControlMessageTask.model_fields
~ControlMessageTask.model_fields_set
~ControlMessageTask.name
~ControlMessageTask.id
~ControlMessageTask.properties


11 changes: 11 additions & 0 deletions docs/sphinx_docs/source/user_guide/api_docs/api/primitives.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
=========
Primitives
=========
.. currentmodule:: nv_ingest_api.primitives.control_message_task

Constructor
~~~~~~~~~~~
.. autosummary::
:toctree: api/

ControlMessageTask
14 changes: 14 additions & 0 deletions docs/sphinx_docs/source/user_guide/api_docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. nv-ingest-api:
=============
API reference
=============

This page provides a list of all publicly accessible modules, methods and classes through
``nv-ingest-api.*`` namespace.

.. toctree::
:maxdepth: 2
:caption: API Documentation

api/primitives
6 changes: 6 additions & 0 deletions docs/sphinx_docs/source/user_guide/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.. toctree::
:maxdepth: 2
:caption: nv-ingest User Guide

api_docs/index

0 comments on commit 6b872bb

Please sign in to comment.