Open roastduck opened 2 years ago
Hi, thanks for the report. I think setting __name__
, __doc__
and __wrapped__
attributes should be enough, but maybe it's not. Did you try using functools.wraps
instead?
functools.wraps
does not meet my use case well. The reason is that I am generating multiple functions from one stub function, instead of replacing an original function with a new one, so the generated functions should have different meta data from the original one, but functools.wraps
just sets the original function's meta data to the new one.
Besides, I have also tried setting __module__
. It does not work either.
I see, thanks. I'll to have to run a debug session to see exactly what's going wrong (I'm on mobile right now, will have time next week).
Describe the bug I am using a function wrapper to produce multiple functions from a stub one, and set the produced function with different names and docs. However, the produced functions are not displayed in the page generated from mkdocstrings. If I set
show_if_no_docstring
, it appears but without any document.The function wrapper
mypartial
is as below.Surprisingly to me, this piece of code works. But if I import
mypartial
from another module (just another file aside), it does not. I am wondering what is the difference whethermypartial
is defined in another module.I noticed there is some discussions in https://github.com/mkdocstrings/mkdocstrings/issues/162. But my case is a little bit different, because my decorated function has a different name and doc from the original one.
To Reproduce Run the code above, but define
mypartial
in a separated file.Expected behavior Function
xxx
should be documentedScreenshots The function
xxx
just disappears.System (please complete the following information):
pytkdocs
version 0.16.1