pydoc 不一致?

发布于 2024-10-07 11:35:05 字数 582 浏览 0 评论 0原文

我有一个结构如下的包:

a/a1/a1.py

a/a2/a2.py

a/a3/a3.py

在 a3.py 中,我导入了模块 a1 和 a2,如下所示:

import a1.a1
import a2.a2

然后我运行

pydoc -w a/

它会生成 a. html、a.a1.html、a.a1.a1.html、a.a2.html、a.a2.a2.html、a.a3.html、a.a3.a3.html。 a3的问题是,导入的链接,即a1.a1和a2.a2是a1.a1.html和a2.a2.html。它们应该是 a.a1.a1.html 和 a.a2.a2.html。 有人对如何修复它有任何建议吗?谢谢

[更新]。我现在将 a3.py 中的导入更改为:

import a.a1.a1
import a.a2.a2

生成的 a.a3.a3.html 只有一个指向 a 的链接为 a.html。我仍然想要指向 a1.a1 和 a2.a2 的链接。有什么建议吗?

I have a package structured like this:

a/a1/a1.py

a/a2/a2.py

a/a3/a3.py

In a3.py, I imported modules a1 and a2 like these:

import a1.a1
import a2.a2

Then I run

pydoc -w a/

It produces a.html, a.a1.html, a.a1.a1.html, a.a2.html, a.a2.a2.html, a.a3.html, a.a3.a3.html.
The problem with a3 is, the links of the imports, i.e., a1.a1 and a2.a2 are a1.a1.html and a2.a2.html. They are supposed to be a.a1.a1.html and a.a2.a2.html.
Anyone has any suggestions on how to fix it? Thanks

[Update]. I now change the imports in a3.py to:

import a.a1.a1
import a.a2.a2

The generated a.a3.a3.html has only one link to a as a.html. I still want links to a1.a1 and a2.a2. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

超可爱的懒熊 2024-10-14 11:35:05

好吧,您可以:

  • 更改为 a/ 目录,然后分别在您的目录上运行 pydoc
  • 严格控制您的导入结构,因为 Python 3 强制您这样做(即 import a.a1.a1from ..a1 import a1)
  • 使用更新的方法来制作 HTML 文档,例如 Sphinx (不过,有一些学习曲线)。

Well, you could:

  • Change into the a/ directory, then run pydoc on your directories separately
  • Be strict with your import structure, as Python 3 forces you to (i.e. import a.a1.a1 or from ..a1 import a1)
  • Use a newer way to make HTML documentation, like Sphinx (there is some learning curve, though).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文