How to generate function signature using sphinx?

The structure and package files are configured as follows:

$ tree . . ├── doc │  ├── Makefile │  ├── README.md │  ├── _build │  ├── _static │  ├── conf.py │  ├── foo.rst │  ├── index.rst │  └── make.bat └── foo ├── __init__.py └── spam.py $ cat foo/__init__.py r''' The Foo module ============== .. autosummary:: :toctree: generated spam ''' $ cat foo/spam.py r''' The Spam Module =============== ''' def prepare(a): '''Prepare function. Parameters ---------- a : int ''' print(a) $ cat doc/index.rst Welcome to foo documentation! ===================================== API Reference ------------- .. toctree:: :maxdepth: 1 foo Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` $ cat doc/foo.rst .. automodule:: foo 

After make html , the prepare function is specified to create the sphinx documentation, but there is no signature for this function:

 $ cat generated/foo.spam.rst foo.spam ======== .. automodule:: foo.spam .. rubric:: Functions .. autosummary:: prepare 

My question is how to generate then, how can I automatically generate a function signature in this case?

+6
source share
1 answer
 .. automodule:: foo.spam 

I think this is your problem (if you have not solved it yet)

Would it be wrong

 .. automodule:: spam 
0
source

All Articles