【发布时间】:2021-09-05 19:16:13
【问题描述】:
我使用存根文件(即“*.pyi”文件)来管理项目中的类型注释。我的文档字符串在实际的源文件中。我安装了sphinx-autodoc-annotation 让Sphinx 查看类型注释,但它不查看存根文件。通过 Sphinx 生成文档时,如何从存根文件中提取类型?
foo.pyi
class Foo:
def bar(self, baz: str) -> str:
...
foo.py
>class Foo:
def bar(self, baz):
"""Does some cool stuff
:param baz: some parameter that we do stuff with
"""
return baz
【问题讨论】:
-
@mzjn 谢谢!该问题的解决方案很可能适用于我的用例。不幸的是,它似乎没有得到解决。
标签: python annotations python-sphinx stub python-typing