[英]Can single pdoc generated pages document APIs spread over multiple files?
I have a Python package which is spread over multiple files:我有一个 Python package 分布在多个文件中:
package/__init__.py
package/thing_a.py
package/thing_b.py
package/thing_c.py
package/submodule/__init__.py
package/submodule/...
The thing_XXX
s break apart chunks of internal code into something that is easier for me to manage. thing_XXX
将内部代码块分解成更易于管理的东西。 The __init__.py
files exports the public APIs that I want at the top-level and within each submodule: __init__.py
文件在顶层和每个子模块中导出我想要的公共 API:
from .thing_a import the_greatest_thing
from .thing_b import even_greater_thing
from .thing_c import i_am_the_best
What I would like is for the documentation to display the docs for the_greatest_thing
, even_greater_thing
and i_am_the_best
and provide a link to look at what's in submodule
.我想要的是文档显示
the_greatest_thing
、 even_greater_thing
和i_am_the_best
的文档,并提供一个链接来查看submodule
中的内容。 What I get is a landing page which shows thing_a
, thing_b
, thing_c
and submodule
as submodules which I need to click on to get documentation.我得到的是一个登录页面,其中显示了
thing_a
、 thing_b
、 thing_c
和submodule
作为子模块,我需要单击这些子模块来获取文档。 All the thing_XXX
s are private and I use __init__.py
to decide what gets exported - this is true also for the contents of the submodule.所有的
thing_XXX
都是私有的,我使用__init__.py
来决定导出什么 - 这对于子模块的内容也是如此。 I would be happy to prefix them with underscores (which does prevent them showing up in the documentation) but I still can't seem to figure out how to bring all the documentation I want together.我很乐意在它们前面加上下划线(这确实会阻止它们出现在文档中),但我似乎仍然无法弄清楚如何将我想要的所有文档放在一起。
Can this be done with pdoc?这可以用 pdoc 完成吗? Or am I trying to do something wild and silly?
还是我想做一些疯狂而愚蠢的事情?
You should be able to explicitly include the in the documentation of __init__.py
by listing them in __all__
: https://pdoc.dev/docs/pdoc.html#control-what-is-documented您应该能够通过在
__all__
中列出它们来明确地将它们包含在__init__.py
的文档中: https://pdoc.dev/docs/pdoc.html#control-what-is-documented
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.