当多个项目具有相同的基本模块名称时,Pylint 不处理导入
我们在源代码树的不同部分有一系列代码项目,它们都有一个基本包 company_name
,其中一些项目互相导入功能。当运行代码、setuptools和declare_namespace处理将模块拼凑在一起时,这工作得很好。然而,pylint 似乎并没有感受到魔力,因此大量文件出现了大的高优先级错误Unable to import X from company_name
。 PYTHONPATH 没有帮助,也许 pylints --init-hook= 中有一些魔法?任何提示和想法都非常受欢迎!
We've got a series of code projects in different parts of our source tree that all have a base package company_name
, and some of them import functionality from eachother. This works just fine when running the code, setuptools and declare_namespace handle peicing together the modules. However, pylint doesn't seem to be feeling the mojo, so a large number of files have large high-prio errors Unable to import X from company_name
. PYTHONPATH doesn't help, maybe some magic in pylints --init-hook=? Any hints and ideas super welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在一次从许多项目导入基于目录的设置时遇到类似的问题。
我的肮脏解决方案是创建符号链接,每个符号链接具有不同的名称(例如projectA/settings -> projA_settings,projectB/settings -> projB_settings),然后使用该导入:
或
I have similar problem with import directory-based settings from many projects at once.
My dirty solution is to make symlinks, each with different name (eg. projectA/settings -> projA_settings, projectB/settings -> projB_settings) and then use that import:
or