Skip to content

Expose C++ Doxygen comments in Python __doc__#157

Open
AdityaPandeyCN wants to merge 2 commits intocompiler-research:masterfrom
AdityaPandeyCN:comments_api
Open

Expose C++ Doxygen comments in Python __doc__#157
AdityaPandeyCN wants to merge 2 commits intocompiler-research:masterfrom
AdityaPandeyCN:comments_api

Conversation

@AdityaPandeyCN
Copy link

This PR integrates Doxygen documentation comments from C++ into Python's __doc__ attribute for methods exposed via cppyy.

  1. Override CPPMethod::GetDocString() to append Doxygen comments after the method prototype
  2. Add Cppyy::GetDoxygenComment() API declaration to retrieve documentation from the backend

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
GetSignatureString(fa).c_str());
}

PyObject* CPyCppyy::CPPMethod::GetDocString()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have defined this function, but not called/used anywhere.
Also, due to implementation details __doc__ needs to be the function signature and not the doxygen string. Example:

In [2]: cppyy.gbl.std.vector[int].push_back.__doc__
Out[2]: 'void std::vector<int>::push_back(const std::vector<int>::value_type & __x)\nvoid std::vector<int>::push_back(std::vector<int>::value_type && __x)'

If you are interested look at the following PRs:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base class https://github.com/compiler-research/CPyCppyy/blob/master/src/PyCallable.h#L23 defines this a virtual function. I wanted to override to append doxygen comments.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants