Sphinx autodoc不导入任何内容?

问题描述 投票:5回答:2

我正在尝试使用sphinx(与autodocnumpydoc结合使用)来记录我的模块,但是在完成基本设置后,运行make html只会生成基本的html,而所包含的文档字符串都不包含任何内容。我正在运行Python 3.3,项目结构的概述如下:

Kineticlib
|--docs
|  |--build
|  |--source
|  |  |--conf.py
|--src
|  |--kineticmulti
|  |  |--__init__.py
|  |  |--file1.py
|  |  |--file2.py
|--setup.py

[__init__.py为空,并且在conf.py目录的docs/source中添加了sys.path.insert(0, os.path.abspath('../..'))

make html目录中运行docs给出以下输出:

sphinx-build -b html -d build/doctrees   source build/html
Running Sphinx v1.2.2
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.

Build finished. The HTML pages are in build/html.

所以,我在做什么错?

python python-sphinx autodoc
2个回答
8
投票

您是否在docs / source目录中运行了sphinx-apidoc?这将生成用于制作html的.rst文件。从man sphinx-apidoc

sphinx-apidoc [options] -o <outputdir> <sourcedir> [pathnames ...]

[您需要(至少)包括outputdir(。rst文件将进入的位置,。/应该可以工作)和sourcedir,它应指向您的软件包(看起来像../.。 / src / kineticmulti应该可以))>


0
投票

正如所说的,您应该做:

© www.soinside.com 2019 - 2024. All rights reserved.