Skip to content

Add Python Docstrings From Doxygen Comments#8895

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
lewisjb:python-docstrings
Jun 29, 2017
Merged

Add Python Docstrings From Doxygen Comments#8895
opencv-pushbot merged 1 commit intoopencv:masterfrom
lewisjb:python-docstrings

Conversation

@lewisjb
Copy link
Copy Markdown
Contributor

@lewisjb lewisjb commented Jun 12, 2017

This pull request changes:

The automatic generation of Python bindings.
Specifically, it parses the Doxygen comments; and adds them as the docstrings for python.

This allows OpenCV Python users to see information about a function without having to use Google:

>>> help(cv2.copyMakeBorder)

previously, this would just show different ways of calling this function; but now will show that and the Doxygen comments.

There is the slight issue that the comments use C++ examples; but if the user were to Google the function, they would get that anyway.

Another benefit to this is that it could be used to help make Python-specific docs.

Notable code changes

Previously, a declaration generated by hdr_parser.py was 4 elements long, with an undocumented optional 5th (original return type). I have changed this so that it is always 6 elements long, with no optionals, to keep things simple.

Current issues

List of issues I have found and am currently working on fixing
None, if you find any issues, please leave a comment

@lewisjb lewisjb force-pushed the python-docstrings branch 2 times, most recently from 29e8f4e to 7ae10da Compare June 14, 2017 01:07
@lewisjb lewisjb force-pushed the python-docstrings branch from e89a115 to 078b4cc Compare June 14, 2017 06:47
@mshabunin
Copy link
Copy Markdown
Contributor

@lewisjb , looks great! Do you plan to add support for other doxygen comments?

/*! doc */
//! doc
/// doc
some_identifier //!< doc

@lewisjb
Copy link
Copy Markdown
Contributor Author

lewisjb commented Jun 22, 2017

@mshabunin Thanks! To be honest, I had forgotten to check if they were being used; I will add support for them now.

EDIT: I did a quick check and couldn't find any usages. I can add better Doxygen support if you would like (different comment styles, concatenating comment blocks); but it will increase the complexity of the code due to all the different Doxygen commands.

@mshabunin
Copy link
Copy Markdown
Contributor

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants