小编lal*_*alu的帖子

为什么 sphinx 自动模块不显示任何模块成员?

我开始研究一个 python 模块,并希望“就地”记录代码。因此,我使用 sphinx-quickstart 在子目录中设置了 sphinx,从而生成了此目录结构(仅显示了我编辑的文件):

  • 我的项目/
    • __init__.py
    • 主文件
  • docs/(狮身人面像目录)
    • 建造/
    • 来源/
      • 配置文件
      • 索引.rst
  • 设置文件

我的 index.rst 包含:

Welcome to My Module's documentation!
=====================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

.. automodule:: myproject
    :members:


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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Run Code Online (Sandbox Code Playgroud)

当我跑

make html
Run Code Online (Sandbox Code Playgroud)

我得到了一个缺少自动模块部分的文档,尽管我记录了 main.py 中的每个类和每个方法,如下所示:

class Thing:
    """This class represents Things

    :param color: how the thing should look like
    """

    def __init__(self, color):
        pass

    def color(self):
        """Tells you the color of the thing.

        :returns: Color …
Run Code Online (Sandbox Code Playgroud)

python module python-sphinx autodoc

9
推荐指数
2
解决办法
7432
查看次数

标签 统计

autodoc ×1

module ×1

python ×1

python-sphinx ×1