AcademySoftwareFoundation / MaterialX

MaterialX is an open standard for the exchange of rich material and look-development content across applications and renderers.
http://www.materialx.org/
Apache License 2.0
1.87k stars 353 forks source link

Sphinx Python Documentation #342

Open jstone-lucasfilm opened 4 years ago

jstone-lucasfilm commented 4 years ago

Add support for the generation of Sphinx documentation for MaterialX Python, using the approach described here:

https://pybind11.readthedocs.io/en/stable/advanced/misc.html#generating-documentation-using-sphinx

StefanHabel commented 1 year ago

I'd like to take a stab at this for the ASWF Dev Days 2023.

If I’m understanding this right, the work here roughly consists of two parts:

  1. Integrating a Sphinx build of the MaterialX Python API documentation into the MaterialX CMake build
  2. Adding/extending docstrings for MaterialX Python bindings using pybind11

While it may not be possible/feasible to add/curate docstrings for all MaterialX Python bindings during Dev Days, it should be possible to lay the foundation for building API documentation using Sphinx on the day.

Proposed approach/outcome:

Proposed artifacts:

  1. A new CMake module at cmake/modules/FindSphinx.cmake to be able to find the sphinx-build executable (Windows: sphinx-build.exe) from documents/CMakeLists.txt using find_package(Sphinx).
  2. Modifications to documents/CMakeLists.txt to create a new build target named MaterialXDocsPython, which would run sphinx-build to generate Python API developer documentation, in a directory that is separate to the existing doxygen-generated html documentation, e.g. named html-sphinx.
  3. A Sphinx configuration template file (e.g. documents/sphinx-conf.py.in) that would be filled with values of configuration variables like MATERIALX_LIBRARY_VERSION as part of the build, in order to generate the conf.py file that sphinx-build uses.
  4. Integration of existing developer guide contents in Markdown format from documents/DeveloperGuide/ into the Sphinx-generated Python API documentation, e.g. using the myst_parser extension:
  5. A new paragraph in the Building API Documentation section in documents/DeveloperGuide/MainPage.md to describe how to build the Python API documentation using Sphinx.
  6. Integration of docstrings from MaterialX Python bindings that are defined in source/PyMaterialX/ from compiled Python C extensions, e.g. from lib/PyMaterialXCore.cpython-312-darwin.so etc.
StefanHabel commented 2 months ago

I'd like to continue our work on this from last year’s ASWF Dev Days next week: https://github.com/AcademySoftwareFoundation/MaterialX/pull/1567