Add docstring generation for Python wrapper #2038
Open
+230
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the capability to extract Doxygen documentation from the C++ source code and insert these docs into the Python bindings. This means that the documentation is then available in the
help()
function. The functionality can be seen in these examples:To generate these Python docstrings, follow these steps:
build/<build-name>/doc
, but it might still work if you use thedoc/Doxyfile.in
(if, for example, you haven't built GTSAM yet and don't want to build it just to compile the Doxyfile).GTSAM_BUILD_PYTHON_DOCS_FROM_XML
to ON.GTSAM_PYTHON_DOCS_XML_SOURCE
to the path to thexml
folder generated by Doxygen.pip install .
it.The parser is fairly robust but not perfect. I encourage anybody to test it out on functions that have well-formatted documentation in the source code so that we can improve it (naturally, the parser can only work with what's in the source--bad or poorly formatted source docs --> bad or poorly formatted Python docs).
To build these docstrings automatically with the pypi package that @yambati03 is working on, the build process will need to be amended so that Doxygen XML is generated before GTSAM Python is built. It takes about 3 minutes to generate the Doxygen files on my machine, and that can probably be shortened if necessary by editing the Doxyfile to not build unnecessary files.
Lastly--this PR edits
wrap
. Does that mean the changes need to be duplicated in thewrap
repo? Not sure what the practice is there.