rst
を含むファイルで Sphinx を実行していますautomodule
が、効果がないようです。
詳細は次のとおりです。agent.py
クラスを含むファイルを含むPythonプロジェクトがありますAgent
。apidoc
ファイルを含むサブディレクトリもありますagent.rst
(によって生成されますsphinx-apidoc
):
agent module
============
.. automodule:: agent
:members:
:undoc-members:
:show-inheritance:
sphinx-build -b html apidoc apidoc/_build
プロジェクトのディレクトリを現在の作業ディレクトリとしてsphinx を実行します。
Python ファイルが確実に見つかるように、次のファイルを に含めましたapidoc/conf.py
。
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
エラーなしで実行されますが、結果の HTML ファイルを開くと、「エージェント モジュール」しか表示されず、すべてが空白です。Agent
クラスとそのメンバーが表示されないのはなぜですか?
更新: 元の問題は、私sphinx.ext.autodoc
がconf.py
. しかし、今では、次のような警告が表示されます。
WARNING: invalid signature for automodule ('My Project.agent') WARNING: don't know which module to import for autodocumenting 'My Project.agent' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name) WARNING: autodoc: failed to import module 'agent'; the following exception was raised: No module named 'agent'