Sphinx不为已声明的模块生成文档

时间:2017-02-24 17:36:18

标签: python python-sphinx

我直接关注this tutorial

我的代码位于N:/Tools/data/generic_accessor.py

generic_accessor.py包含类似的内容:

def access_hfri_returns(terms=[]):
    """
    This accesses HFRI returns data.
    Returns:

    """

在generic_accessor中只有函数而没有类。

我补充说:

sys.path.insert(0,"N:\\Tools\\data")

N:\Tools\data\conf.py

我的N:\Tools\data\index.rst读取:

.. data documentation master file, created by
   sphinx-quickstart on Fri Feb 24 11:52:57 2017.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to data's documentation!
================================

Contents:

.. toctree::
   :maxdepth: 2

.. automodule:: generic_accessor

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

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

我重新make html但我的N:\Tools\data\_build\html\index.html看起来像这样: enter image description here

我在任何地方都看不到generic_accessor的文档。

感谢您提供任何指导。

1 个答案:

答案 0 :(得分:0)

尝试以下修改。请注意,我使用.txt文件。

index.txt

  .. data documentation master file, created by
   sphinx-quickstart on ...
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to data's documentation!
===================================

Contents:

.. toctree::
   :maxdepth: 2

   generic_accessor




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

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

generic_accessor.txt

:mod:`generic_accessor`
==========================

.. automodule:: generic_accessor
    :members:
    :undoc-members:
    :inherited-members:
    :show-inheritance: