vir*_*tor 11 python documentation-generation python-sphinx
我正在尝试仅为所选模块使用autodoc.我创建了一个文件,其中包括:
.. automodule:: some.specific.module
:members:
Run Code Online (Sandbox Code Playgroud)
并且它正确生成.不幸的是,autodoc也在不断尝试解析其他文件(并且由于导入错误而失败).我知道我可以嘲笑一些模块,但我想要一个更好的解决方案 - 阻止sphinx开始看它们.
如何确保仅加载所请求的模块,而不是(例如)test.other.module.
结果证明这是一个愚蠢的错误。由于某些工具为 api 文档源生成了一个脚手架,因此这些文件被闲置并引发了错误的导入。
这是如何发现的:
[autodoc] /path/to/the/doc.rst:158: input:
.. automodule:: app.module.name
:members:
Run Code Online (Sandbox Code Playgroud)