I am running Sphinx on a rst
file containing automodule
but it does not seem to have any effect.
Here are the details: I have a Python project with a file agent.py
containing a class Agent
in it. I also have a subdirectory apidoc
with a file agent.rst
in it (generated by sphinx-apidoc
):
agent module
============
.. automodule:: agent
:members:
:undoc-members:
:show-inheritance:
I run sphinx with sphinx-build -b html apidoc apidoc/_build
with the project's directory as the current working directory.
To make sure the Python files are found, I've included the following in apidoc/conf.py
:
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
It runs without errors but when I open the resulting HTML file it only shows "agent module" and everything is blank. Why isn't it showing the class Agent
and its members?
Update: the original problem was likely caused by the fact that I had not included sphinx.ext.autodoc
in conf.py
. Now that I did, though, I get warnings like:
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'