狮身人面像是否能使用不能导入的代码? [英] Will Sphinx work with code that doesn't import well?

查看:145
本文介绍了狮身人面像是否能使用不能导入的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sphinx文档引擎能否成功生成不能导入的项目的文档?特别是我的项目有异国依赖。我不希望文档生成依赖于这种依赖关系。

Will the Sphinx documentation engine successfully generate documentation on a project that doesn't import well? In particular my project has an exotic dependency. I don't want document generation to depend on this dependency.

Sphinx是否需要导入我的模块并使用内省或解析?

Does Sphinx need to import my module and use introspection or does it parse?

推荐答案

如果您使用autodoc扩展名,那么是的,您的项目必须是可导入的。但是有时可能会在 conf.py 中模拟依赖关系(因为可能,在导入时,依赖关系仅在名称中需要)。阅读文档文档有一个如何做到这一点

If you're using the autodoc extension, then yes, your project must be importable. But sometimes it's possible to mock out dependencies in your conf.py (since, presumably, at the time of import, the dependencies are needed in name only). The Read the Docs documentation has an example of how to do this.

这篇关于狮身人面像是否能使用不能导入的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆