Add docstring generation for Python wrapper#2038
Conversation
dellaert
left a comment
There was a problem hiding this comment.
Cool! Some issues:
- indeed, wrap is pulled in from a different repo. Maybe @varunagrawal can comment on correct way to change wrap and get it back into GTSAM.
- that also affects the flag names: wrap is not GTSAM, so cmake variables there have a different naming convention I think
- Finally, is it possible to not need GTSAM_PYTHON_DOCS_XML_SOURCE?
Yes, it is now changed to look for xml in {project_root}/xml. Regarding the other two points:
I await @varunagrawal for confirmation on (1) and insight on (2). |
This is pretty interesting. I wonder why this isn't just a Git submodule? Then, the |
|
@yambati03 We opted to make |
|
@p-zach check out https://github.com/borglab/wrap. You'll want to move your changes over there so that they don't get overwritten the next time we pull that subtree in. Let me know if you need any help with understanding that repo. Happy to connect offline. |
I wouldn't say Github tarbulls don't work, but they need some extra work. Lots of people have gotten this to work with submodules. |
|
Also FYI, there are a lot of subfolders in wrap that were originally intended for documentation generation but I guess they were never completed? If @p-zach's updates work, we should nuke those others and clean up the repository as general housekeeping. |
|
Changes have been migrated to borglab/wrap#170. Once that's merged, I will pull them into this PR. |
|
Hi @p-zach can you make a single PR that just update wrap with |
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_XMLto ON.GTSAM_PYTHON_DOCS_XML_SOURCEto the path to thexmlfolder 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 thewraprepo? Not sure what the practice is there.