[英]How to hide 3rd party imports from pdoc?
What is the proper way to hide imports from a documentation generator like pdoc?从像 pdoc 这样的文档生成器中隐藏导入的正确方法是什么?
Specifically, what is best practice for generating docs on adhoc scripts?具体来说,在临时脚本上生成文档的最佳实践是什么?
For example:例如:
import someThirdPartyLibrary
def main():
someThirdPartyLibrary.somefunc()
if __name__ == '__main__':
main()
One needs to have someThirdPartyLibrary
installed in the environment or pdoc will FAIL.需要在环境中安装一些
someThirdPartyLibrary
,否则 pdoc 将失败。
The options seem to be:选项似乎是:
A. Install all 3rd party libraries to whatever environment I'm running pdoc from. A. 将所有 3rd 方库安装到我正在运行 pdoc 的任何环境中。 This seems totally unnecessary since pdoc doesn't need to actually run the code only load it.
这似乎完全没有必要,因为 pdoc 不需要实际运行代码只加载它。
B. Hide imports in main and violate PEP8 B. 在 main 中隐藏导入并违反 PEP8
def main():
import someThirdPartyLibrary
someThirdPartyLibrary.somefunc()
if __name__ == '__main__':
main()
C. Something better than A and B that is best practice? C. 比 A 和 B 更好的最佳实践是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.