简体   繁体   中英

Using poetry and pip to install dependencies with private repositories

Ahoi!

We are a small team and currently using poetry for developing our python packages. Since we do have a private artifactory we have the following pyproject.toml things set:

[[tool.poetry.source]]
name = "main-private-artifactory"
url = "https://xx.yy"
default = true


[[tool.poetry.source]]
name = "special-private-arti"
url = "https://xx.mm"

Which works well when using poetry. No outgoing calls and it finds the packages quite fine. just for completeness sake the special package is specified like this in the .toml file:

[tool.poetry.dependencies]
special-package = {version = "^1.0.0", source = "special-private-arti"}

Now since pip should support installing from a pyproject.toml I created a new venv and tried to install our packages dependencies by executing:

pip install . -vv

in the same directory where pyproject.toml resides. I have a few problems with that:

  1. When looking at the verbose output it shows pip is calling https://pypi.org/simple which should be a BIG nono according to my pyproject.toml file.
  2. It does not find the special package since it ignores my defined sources

Anyone have an approach I can try other than changing back to venv and requirements.txt ?

Cheers, ~HFinch

I am actually fighting with the same issue. Have you already found a solution?

I found out that using the -i/--index-url of pip helps, when your private pypi server redirects also to pypi.org/simple.

So as workaround for me worked

pip install . -vv -i https://xx.mm

As a next step will check the poetry issues on gitlab.

Cheers Tom

What about:

poetry run pip3 install [pkg name] [-i] [url]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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