2016-01-17 38 views
6

paket yapısı ve dosyaları bu gibi ayarlanır:Sfenks ile fonksiyon imzası nasıl oluşturulur?

$ 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's documentation! 
===================================== 

API Reference 
------------- 

.. toctree:: 
    :maxdepth: 1 

    foo 


Indices and tables 
================== 

* :ref:`genindex` 
* :ref:`modindex` 
* :ref:`search` 


$ cat doc/foo.rst 
.. automodule:: foo 

sfenks belgeleri oluşturmak için make html sonra işlev prepare dışarı listelenir ancak belgelenmiş bu fonksiyonun imzası var olmayan:

$ cat generated/foo.spam.rst 
foo.spam 
======== 
.. automodule:: foo.spam 

    .. rubric:: Functions 

    .. autosummary:: 

     prepare 

Benim soru nasıl üretilir, bu durumda otomatik olarak işlev imzasını nasıl üretebilir?

+0

olurdu bu sorunu olduğunu düşünüyorum kodlanmış 'rst' stubs? – donkopotamus

+0

'sphinx-autogen' – RNA

+0

' foo.spam.rst''''namesinin 'autosummary' bloğu içinde' hazırla 'imzasını içereceğini mi düşünüyorsunuz? Çünkü "autodoc" tarafından üretilecek (ve sonuçta ortaya çıkan ** çıkışa eklenecektir). – donkopotamus

cevap

0
.. automodule:: foo.spam 

Sana `sfenks-autogen` veya el kullanıyorsunuz (eğer henüz çözülmüş değil ise)

değil doğru yolu

.. automodule:: spam 
+0

'created/foo.spam.rst' otomatik olarak oluşturuldu – RNA

+0

evet ama automodule ilk kez değil py görünüyor –

İlgili konular