简体   繁体   English

如何在 pyproject.toml 文件中配置特定于操作系统的依赖项 [Maturin]

[英]How to configure os specific dependencies in a pyproject.toml file [Maturin]

I have a rust and python project that I am building using Maturin( https://github.com/PyO3/maturin ).我有一个 Rust 和 python 项目,我正在使用 Maturin ( https://github.com/PyO3/maturin ) 构建。 It says that it requires a pyproject.toml file for the python dependencies.它说它需要一个用于 python 依赖项的pyproject.toml文件。

I have a dependency of uvloop , which is not supported on windows and arm devices.我有uvloop的依赖性,Windows 和 arm 设备不支持它。 I have added the code that conditionally imports these packages.我添加了有条件地导入这些包的代码。 However, I do not know how to conditionally install these packages.但是,我不知道如何有条件地安装这些包。 Right now, these packages are getting installed by default on every OS.现在,这些软件包默认安装在每个操作系统上。

Here is the pyproject.toml file.这是 pyproject.toml 文件。

[project]
name = "robyn"
dependencies = [
  "watchdog>=2.1.3,<3",
  "uvloop>=0.16.0,<0.16.1",
  "multiprocess>=0.70.12.2,<0.70.12.3"
]

And the github link, jic anyone is interested: https://github.com/sansyrox/robyn/pull/94/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R21和 github 链接,jic 任何人都感兴趣: https : //github.com/sansyrox/robyn/pull/94/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R

If you don't want to install on windows, specify like this:如果您不想在 Windows 上安装,请指定如下:

# assuming you're using poetry
uvloop = {version = "^0.16.0", markers = 'sys_platform != "win32"'}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM