Pybindgen auto-generate docstring

Asked by Braud

Hello here,

I am using pybindgen extensively, and I love it so far. My only gripe is that although I have defined everything by hand (no pygccxml here) the generated library contains no docstrings at all. Of course, I did not provide one in my definitions but in my opinion, these docstrings should contain at least the function signature, in a way that is displayable by autocompletion tools, such as python-jedi.

I implemented my changes quickly in my local version of pybindgen, here is a small (albeit dirty) diff :
function.py:
64d63
< self.raw_parameters = parameters #Keep the raw parameter for easy access, probably useless
270,277c269
< (self.docstring is None and self.generate_docstring(name) or ('"'+self.docstring+'"')))
<
< def generate_docstring(self, name):
< return '"'+name+"("+",".join(map(lambda x: x[0]+" "+x[1], self.raw_parameters))+")"+'"'
---
> (self.docstring is None and "NULL" or ('"'+self.docstring+'"')))

Do you think this is a desirable feature of pybindgen ? I think it could be extended to be prepended to every user-supplied docstring, and it could be optional.

Just as an example, difference using this project : https://github.com/jorisv/SpaceVecAlg

Without my modification : http://i.imgur.com/M6p5dzD.png

With my modification : http://i.imgur.com/GoMjUw7.png

Thanks a lot for the awesome project !

Question information

Language:
English Edit question
Status:
Answered
For:
PyBindGen Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Gustavo Carneiro (gjc) said :
#1

Yes, something like that I think is useful to do in case no other docstring is provided. Although I'm not entirely happy about showing C++ types in the docstring, they should be the Python equivalent ones.

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Gustavo Carneiro (gjc) said :
#3

Sorry for not following up on this yet.

Revision history for this message
Gustavo Carneiro (gjc) said :
#4

OK, I created a bug report from this.

Can you help with this problem?

Provide an answer of your own, or ask Braud for more information if necessary.

To post a message you must log in.