英文:
How do I specify that I want a dependency on all but a specific platform with Poetry?
问题
我有一个依赖于wxPython的项目。以前,我们一直在使用Hatch来管理项目,但现在出于各种原因,我们考虑切换到Poetry。使用Hatch,可以指定在所有平台上安装依赖项,但不包括特定平台,如下所示:
wxpython>=4.2.1 ; platform_system != 'Linux'
浏览Poetry文档,我找不到类似的内容。我只能找到如何将依赖项限制为特定平台,但这里我想要排除一个特定平台。
英文:
I have a project which depends on wxPython. Previously, we've been using Hatch to manage the project, but we are now considering switching to Poetry for various reasons. With Hatch, it was possible to specify that a dependency should be installed on all platforms but a specific one like so:
wxpython>=4.2.1 ; platform_system != 'Linux'
Looking through the Poetry docs, I can't find anything similar. All I can find is how to restrict a dependency to a specific platform, but here I want to do all but one specific platform.
答案1
得分: 1
环境标记 可以用来实现这一点。以下是一个与Poetry兼容的更或多或少等效的行:
wxpython = { version = "4.2.1", markers = "sys_platform != 'linux'", source = "pypi" }
英文:
Environment markers can be used to accomplish this. Here is what a more or less equivalent line that's compatible with Poetry could look like:
wxpython = { version = "4.2.1", markers = "sys_platform != 'linux'", source = "pypi" }
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论