pybind / scikit_build_example

An example combining scikit-build and pybind11
Other
91 stars 29 forks source link

Missing function signatures and docstrings in the generated documentation #136

Closed niketagrawal closed 2 months ago

niketagrawal commented 2 months ago

The documentation generated using Sphinx does not contain the signature and the docstrings of the functions add and subtract defined in the extension module code in src/main.cpp.

Steps to reproduce the issue:

docs_without_fix

The target module from which docstrings and function signature are to be extracted as documentation is incorrectly referenced in docs/python_example.rst as highlighted in the make html outout below.

$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v7.3.6

WARNING: Failed to import python_example.
Possible hints:
* ModuleNotFoundError: No module named 'python_example'
* KeyError: 'python_example'
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] python_example
WARNING: autodoc: failed to import module 'python_example'; the following exception was raised:
No module named 'python_example'

writing output... [100%] python_example
/~/scikit_build_example/docs/index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
/~/scikit_build_example/docs/index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
/~/scikit_build_example/docs/index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
generating indices... genindex /~/scikit_build_example/docs/index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
done
writing additional pages... search /~/scikit_build_example/docs/index.rst:6: WARNING: toctree contains reference to document 'python_example' that doesn't have a title: no link will be generated
done
dumping search index in English (code: en)... done
dumping object inventory... done

Fix

scikit_build_example is the correct target module to mention in docs/python_example.rst from which the function signatures and docstrings are to be extracted.

niketagrawal commented 2 months ago

Fix added in #137