简体   繁体   English

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

[英]How do I install packages from test.pypi.org using poetry?

I want to use a pre-release version of a package ( https://test.pypi.org/project/delta-spark/2.1.0rc1/ ) in my project.我想在我的项目中使用 package ( https://test.pypi.org/project/delta-spark/2.1.0rc1/ ) 的预发布版本。

I'm using poetry to manage my pyproject.toml .我正在使用poetry来管理我的pyproject.toml How do I do this?我该怎么做呢?

In other words what is the poetry equivalent of:换句话说, poetry相当于什么:

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

I tried:我试过了:

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

Both give: Could not find a matching version of package delta-spark两者都给出: 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
$ 

This is described here .在此处进行了描述。 Basically, you can add the repository via:基本上,您可以通过以下方式添加存储库:

poetry config repositories.test https://test.pypi.org/simple/

and then make it available in pyproject.toml via:然后通过以下方式使其在pyproject.toml中可用:

[[tool.poetry.source]]
name = "test"
url = "https://test.pypi.org/simple/"
secondary = true

Then adding the dependency should work.然后添加依赖项应该可以工作。

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

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