I am looking to autodoc some functions in a Python module using autofunction. Let's say, for example, the functions are defined in mylib/funcs/a.py and that file looks something like this:
def myfunc(arg):
""" My function does something """
return
My intent is to have users call that function from the root of the library rather than at that file/module path. In other words mylib.myfunc rather than mylib.funcs.a.myfunc.
However, for reasons outside of the scope of this question that I'd rather not get in to, when you do import mylib; mylib.myfunc or do from mylib import myfunc it doesn't point to the actual function where the docstring is.
I can get the function to auto doc like so:
..currentmodule:: mylib.funcs.a
..autofunction:: myfunc
However, the resulting documentation has a signature that looks like mylib.funcs.a.myfunc. I would like it to just be mylib.myfunc.
If I wasn't using autodoc I could do something like this in my sphinx docs:
.. function:: myfunc(arg)
:module: mylib
So I suppose my question is this: Is there a way to "alias" or change the label of a module when using autodoc on a function? I have looked at the preprocessing events for processing a docstring and the signature but those don't seem to allow you to change how the module is displayed.