诗歌可以从AWS CodeArtifact添加包吗



关于如何使用Python Poetry将包发布到CodeArtifact,我找到了多种答案,这非常简单。但现在我尝试添加已发布的包poetry add sample-package,但它不起作用。诗歌错误:

Could not find a matching version of package sample-package

pip install一起工作。但不是诗歌。

我的pyproject.toml将我的CodeArtifact repo指定为默认值。没有问题:

[[tool.poetry.source]]
name = "artifact"
url = "https://test-domain-1234.d.codeartifact.region.amazonaws.com/pypi/test-repo"
default = true

有人知道怎么做吗?

我发现了我的错误。在我发布的包中,我需要指定最后没有/simple的存储库。但对于我使用CodeArtifact中的包的项目,存储库需要以/simple结束。

示例:发布包配置如下所示:

[[tool.poetry.source]]
name = "artifact"
url = "https://test-domain-1234.d.codeartifact.region.amazonaws.com/pypi/test-repository/"
secondary=true

发布命令为:poetry publish --build -r artifact

对于我使用包sample-lib的项目,配置应该是:

[[tool.poetry.source]]
name = "artifact-repo"
url = "https://test-domain-1234.d.codeartifact.region.amazonaws.com/pypi/test-repository/simple"
secondary=true

然后Poetry命令为:poetry add sample-lib --source artifact-repo

最新更新