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

Sphinx not generating documentation for declared module

我直接关注了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 看起来像这样:

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

感谢您的指导。

尝试以下改编。请注意,我使用的是 .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: