与Maturin的混合Python/Rust Project中的预订版本编号
我正在研究一个混合锈/python项目,正在使用Maturin进行。我在弄清楚如何指定可以比PIP安装的预订版本时遇到困难。
我的货物的开始是
[package]
version = "0.0.1-test.1"
当我进行maturin build-release
时,它创建my_project-0.0.0.0.1_test.1-cp39-cp39-cp39-macosx_10_10_7_x86_64.whl
。请注意,版本中的0.0.1-test.1
以轮子的名称更改为0.0.1_test.1
。 (破折号变成了下划线。)
如果我将其发布到我的Nexus Server并尝试将其安装在单独的项目中,则pip
会出现一个错误:
$ pip install my_project==0.0.1_test.1
Looking in indexes: ...
ERROR: Could not find a version that satisfies the requirement my_project==0.0.1_test.1 (from versions: 0.0.1-test.1, 0.0.1.dev1)
如果我尝试使用dash而不是底漆:
pip install py_mod_query_builder==0.0.1-test.1
Looking in indexes: ...
ERROR: Exception:
<stack trace>
pip._vendor.packaging.version.InvalidVersion: Invalid version: '0.0.1-test.1'
如果我将货物中的版本更改为0.0.1_troy.1,那么货物将无法解析构建文件:
$ maturin build --release
I am working on a mixed Rust/Python project being build with maturin. I am having trouble figuring out how I can specify a pre-release version that can than be installed by pip.
The start of my Cargo.toml is
[package]
version = "0.0.1-test.1"
When I do maturin build --release
, it creates my_project-0.0.1_test.1-cp39-cp39-macosx_10_7_x86_64.whl
. Note that 0.0.1-test.1
in the version was changed to 0.0.1_test.1
in the name of the wheel file. (The dash became an underscore.)
If I publish this to my Nexus server and try to install it in a separate project, pip
gives an error:
$ pip install my_project==0.0.1_test.1
Looking in indexes: ...
ERROR: Could not find a version that satisfies the requirement my_project==0.0.1_test.1 (from versions: 0.0.1-test.1, 0.0.1.dev1)
If I try it with a dash instead of an underscore:
pip install py_mod_query_builder==0.0.1-test.1
Looking in indexes: ...
ERROR: Exception:
<stack trace>
pip._vendor.packaging.version.InvalidVersion: Invalid version: '0.0.1-test.1'
If I change the version in Cargo.toml to 0.0.1_troy.1, then Cargo fails to parse the build file:
$ maturin build --release
???? Building a mixed python/rust project
???? maturin failed
Caused by: Cargo metadata failed. Do you have cargo in your PATH?
Caused by: Error during execution of `cargo metadata`: error: failed to parse manifest at `/Users/me/my-project/Cargo.toml`
Caused by:
unexpected character '_' after patch version number for key `package.version`
I did have some success with pip install path/to/my_project*.whl
. However, that is difficult to incorporate into building a docker image. The wheel is outside the project with the Dockerfile, so docker will not be able to find it without jumping through a bunch of hoops, while downloading it from the server during the docker build is simple, but fails due to the dash/underscore problem.
Additionally, while both projects are being developed, I would like the CI pipeline for the development branch to use the pre-release version. Getting access to the wheel file (without having pip download it) is nearly impossible in that situation.
It seems that Cargo insists on the format being #.#.#-string
and pip insists on it being #.#.#_string
. Is there a way to make both of them happy?
Versions:
- Installing project
- pip 22.1
- python 3.9.12
- Building project
- pip 20.0.4
- python 3.9.12
- maturin 0.8.3
- rustc 1.56.1 (59eed8a2a 2021-11-01)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论