安装时不安装依赖的预发布版本

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

pip install --pre without installing pre-releases for dependencies

问题

有一个名为 A 的包在 PyPI 上,它有一个预发行版本 1.0.0rc1

A 有一个依赖项,即包 B,其版本要求为 B >= 1.0.0,但 B 也有一个预发行版本 1.0.0rc1,与 A 不兼容。

我希望能够使用 pip install 安装 A 的预发行版本,同时安装 B 的常规(非预发行)版本。

使用 pip install --pre A 似乎会安装 A 1.0.0rc1B 1.0.0rc1

对于处理这种情况,是否有建议?以下是我考虑过的几种方法:

  1. 固定 B==1.0.0 的版本,但这有些限制,并且需要定期更新,以适应 B 的新版本发布。
  2. 告诉用户使用 pip install A==1.0.0rc1,这样稍微不太方便。

这里的标准方法是什么?谢谢。

英文:

Say I have a package A on pypi with a pre-release version 1.0.0rc1.

Package A has package B as a dependency with version B >= 1.0.0, but B also has a pre-release version 1.0.0rc1 that is incompatible with A.

I want to be able to pip install the pre-release version of A while installing the regular (not-pre) release version of B.

pip install --pre A seems to install A 1.0.0rc1 and B 1.0.0rc1.

Are there any recommendations for dealing with this scenario? A few that I've considered

  1. pin the version of B==1.0.0, but this is a bit limiting and requires me to periodically update as new releases of B come out.
  2. tell users to pip install A==1.0.0rc1, which is slightly less convenient.

What is the standard approach here? Thanks

答案1

得分: 1

这是原始帖子后的很长时间,但我认为这是答案

要实现您想要的基本上应该使用以下命令:

pip install "A>=1.0.0rc0"

通过在您的版本要求中指定预发行标签,然后pip将允许匹配该要求的预发行和开发版本。

英文:

This is ages after the original post, but i think this is the answer.

Basically to chieve what you want you should use the following

pip install "A>=1.0.0rc0"

by specifying the prerelease tag in your version requirement then pip will allow pre-release and development versions matching for that requirement

huangapple
  • 本文由 发表于 2023年2月14日 01:03:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75439020.html
匿名

发表评论

匿名网友

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

确定