简体   繁体   English

单个 pdoc 生成的页面文档 API 可以分布在多个文件中吗?

[英]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_thingeven_greater_thingi_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_athing_bthing_csubmodule作为子模块,我需要单击这些子模块来获取文档。 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM