Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Expose C++ Doxygen comments in Python __doc__ - #157

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

AdityaPandeyCN wants to merge 2 commits into
compiler-research:masterfrom
AdityaPandeyCN:comments_api

Conversation

@AdityaPandeyCN

Copy link
Copy Markdown

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>
Comment thread src/CPPMethod.cxx
GetSignatureString(fa).c_str());
}

PyObject* CPyCppyy::CPPMethod::GetDocString()

Copy link
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants