如何使用诗歌从 test.pypi.org 安装软件包?

Kas*_*yap 1 python pip dependency-management python-poetry

我想在我的项目中使用包的预发布版本(https://test.pypi.org/project/delta-spark/2.1.0rc1/)。

我用来poetry管理我的pyproject.toml. 我该怎么做呢?

换句话说,相当于poetry

pip install -i https://test.pypi.org/simple/ delta-spark==2.1.0rc1

我试过:

  • poetry add delta-spark==2.1.0rc1
  • poetry add --allow-prereleases delta-spark==2.1.0rc1

两者都给出:Could not find a matching version of package delta-spark


$ poetry config --local repositories.test-pypi https://test.pypi.org/
$ poetry config --list | fgrep repositories
repositories.test.url = "https://test.pypi.org/"
repositories.test-pypi.url = "https://test.pypi.org/"
$ fgrep -A 3 tool.poetry.source pyproject.toml 
[[tool.poetry.source]]
name = "test-pypi"
url = "https://test.pypi.org/"
secondary = true
$ poetry add --group dev delta-spark==2.1.0rc1

Could not find a matching version of package delta-spark
$ 
Run Code Online (Sandbox Code Playgroud)

a_g*_*est 6

此处对此进行了描述。基本上,您可以通过以下方式添加存储库:

poetry config repositories.test https://test.pypi.org/simple/
Run Code Online (Sandbox Code Playgroud)

然后通过以下方式使其可用pyproject.toml

[[tool.poetry.source]]
name = "test"
url = "https://test.pypi.org/simple/"
secondary = true
Run Code Online (Sandbox Code Playgroud)

然后添加依赖项应该可以工作。