如何在Poetry中指定我希望依赖于除特定平台之外的所有平台?

huangapple go评论62阅读模式
英文:

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" }

huangapple
  • 本文由 发表于 2023年8月5日 00:27:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76837707.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定