Retry decorator messes up documentation

Hello. I’ve started using nbdev to develop an internal package for the company I work at. I’ve sorted out every problem I encountered, but I’m struggling with this one. I have a retry decorator which is used in many functions inside a module such as the following:

And this is how it is rendered in the documentation. Basically what is shown is not related to the function being decorated, but the function inside the decorator definition (ignore the description in spanish, it’s just the decorator docstring).

Has anyone suffered from this behaviour? any ideas on how to solve it?

1 Like

Does something like this work?

from functools import wraps 

def retry(f):
  @wraps(f)   # this will preserve the __name__ of the function when it's wrapped
  def wrapper():
    return 2 * f()
  return wrapper
1 Like