autodoc

How to properly write cross-references to external documentation with intersphinx?

只愿长相守 提交于 2019-11-28 17:55:40
I'm trying to add cross-references to external API into my documentation but I'm facing three different behaviors. I am using sphinx(1.3.1) with Python(2.7.3) and my intersphinx mapping is configured as: { 'python': ('https://docs.python.org/2.7', None), 'numpy': ('http://docs.scipy.org/doc/numpy/', None), 'cv2' : ('http://docs.opencv.org/2.4/', None), 'h5py' : ('http://docs.h5py.org/en/latest/', None) } I have no trouble writing a cross-reference to numpy API with :class:`numpy.ndarray` or :func:`numpy.array` which gives me, as expected, something like numpy.ndarray . However, with h5py, the

How to document nested classes with Sphinx's autodoc?

▼魔方 西西 提交于 2019-11-28 05:36:52
问题 Is there any way to document a nested class with Sphinx's autodoc plugin? In: class A: class B: """ class B's documentation. """ # ... I want to use autoclass or something similar in my .rst file to document A.B specifically. I tried: .. currentmodule:: package.module .. autoclass:: A.B and .. autoclass:: package.module.A.B without success: /path/to/file.rst:280: WARNING: autodoc: failed to import class 'B' from module 'package.module.A'; the following exception was raised: ... Traceback

Sphinx: how to exclude imports in automodule?

喜你入骨 提交于 2019-11-27 22:12:45
I have a Raspberry Pi project written in Python that uses RPi.GPIO module. All the work on the code is done on a Windows box where RPi.GPIO will not install and every time I try to run autodoc it crashes saying it cannot import RPi.GPIO. D:\cube\docs\ledcube.rst:4: WARNING: autodoc: failed to import module u'ledcube' ; the following exception was raised: Traceback (most recent call last): File "C:\Python27\lib\site-packages\sphinx-1.2b1-py2.7.egg\sphinx\ext\autodoc. py", line 326, in import_object __import__(self.modname) File "D:\cube\ledcube.py", line 2, in <module> import RPi.GPIO as GPIO

How to use Sphinx's autodoc to document a class's __init__(self) method?

我们两清 提交于 2019-11-27 17:28:53
Sphinx doesn't generate docs for __init__(self) by default. I have tried the following: .. automodule:: mymodule :members: and ..autoclass:: MyClass :members: In conf.py, setting the following only appends the __init__(self) docstring to the class docstring ( the Sphinx autodoc documentation seems to agree that this is the expected behavior, but mentions nothing regarding the problem I'm trying to solve): autoclass_content = 'both' mzjn Here are three alternatives: To ensure that __init__() is always documented, you can use autodoc-skip-member in conf.py. Like this: def skip(app, what, name,

How to properly write cross-references to external documentation with intersphinx?

有些话、适合烂在心里 提交于 2019-11-27 10:54:35
问题 I'm trying to add cross-references to external API into my documentation but I'm facing three different behaviors. I am using sphinx(1.3.1) with Python(2.7.3) and my intersphinx mapping is configured as: { 'python': ('https://docs.python.org/2.7', None), 'numpy': ('http://docs.scipy.org/doc/numpy/', None), 'cv2' : ('http://docs.opencv.org/2.4/', None), 'h5py' : ('http://docs.h5py.org/en/latest/', None) } I have no trouble writing a cross-reference to numpy API with :class:`numpy.ndarray` or

Sorting display by class using sphinx with 'autodoc'?

梦想与她 提交于 2019-11-27 09:08:35
Is there a way to display a "Classes" list / tab using Sphinx, or to organize the html pages generated to show members by class, classes being visually well separated? I use Sphinx 1.1.3, an try to document a Python extension (a custom one created with Cython). My problem is that the whole extension is displayed in one single block if I enter the modules tab (which is quite unreadable) and, by the other hand, the "Index" tab merges everything together (which is normal). I would like a per class display (something closer to what Doxygen would do). Does something like: Indices and tables =======

How to use Sphinx's autodoc to document a class's __init__(self) method?

故事扮演 提交于 2019-11-26 22:33:54
问题 Sphinx doesn't generate docs for __init__(self) by default. I have tried the following: .. automodule:: mymodule :members: and ..autoclass:: MyClass :members: In conf.py, setting the following only appends the __init__(self) docstring to the class docstring (the Sphinx autodoc documentation seems to agree that this is the expected behavior, but mentions nothing regarding the problem I'm trying to solve): autoclass_content = 'both' 回答1: Here are three alternatives: To ensure that __init__() is

Sorting display by class using sphinx with &#39;autodoc&#39;?

浪尽此生 提交于 2019-11-26 14:34:53
问题 Is there a way to display a "Classes" list / tab using Sphinx, or to organize the html pages generated to show members by class, classes being visually well separated? I use Sphinx 1.1.3, an try to document a Python extension (a custom one created with Cython). My problem is that the whole extension is displayed in one single block if I enter the modules tab (which is quite unreadable) and, by the other hand, the "Index" tab merges everything together (which is normal). I would like a per