3

I understand that the following generates rst for all modules, excluding the index.rst

sphinx-apidoc -f -o very_good_docs/ very_good

And the following generates everything, including index.rst, conf.py, Makefile, etc

sphinx-apidoc -F -f -o very_good_docs/ very_good

The problem is that sphinx-apidoc does not generate a correct conf.py, so I have to always manually modify conf.py to include the correct sys.paths. If I modify my python code in "very_good" folder, I should run the sphinx-apidoc command without "-F", so conf.py is preserved. However, if I add a new module under very_good directly, index.rst is not updated without the "-F" option, which means my new module will not be in the doc. I guess the solution is to either someone generates the index.rst file only, or using "-F" option without overriding the conf.py. Is there a way to do it?

4

1 回答 1

2

这是我现在正在经历的事情。没有找到信息来实现如此普遍的事情真的很令人沮丧。

我的方法是使用自定义config.py并指定它总是我sphinx-build使用该-F选项执行。这样config.py即使config.py创建了新的(且无用的) my 也不会被覆盖。

为了指定自定义config.py,您应该使用-c文档中所述的选项:

-c path

Don’t look for the conf.py in the source directory, but use the given configuration directory instead. Note that various other files and paths given by configuration values are expected to be relative to the configuration directory, so they will have to be present at this location too.

New in version 0.3.

该命令将如下所示:

sphinx-build -b html -c %sphinxConfigDir% %sourceCode% %buildDir%
于 2015-02-19T12:02:07.483 回答