Closed jmrgibson closed 3 years ago
Hmm. I don't really want to add rust + pyo3 as a dependency, but I should be able to make a test that creates a method descriptor using pure python. I'll dig through python docs and have a test sometime this week.
I was able to use the built-in int.__add__
, which was very convenient. Test added.
Thanks again!
Hi,
I'm trying to add support for python methods created using pyo3. These methods are "built-in" methods, however they can still expose the
__doc__
attribute and a function signature via__text_signature__
.The current implementation detects
method_descriptors
(which is what most native functions end up as), and serializes them as regular methods (since from a caller point of view, they act the same). If the user doesn't provide the__text_signature__
attribute,inspect.signature
will error out, so I made it optional, as I still think it would be useful to have the docstring in the resulting documentation if it exists.Please let me know if this is the right direction for this approach. There are other modifications coming to
mkdocstrings
too, as it currently doesn't populate functions/methods with__text_signature__
or with no signature very well.Thanks,