HFinch
HFinch

Reputation: 626

Using poetry and pip to install dependencies with private repositories

We are 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?

Upvotes: 6

Views: 17315

Answers (2)

deltaparadox
deltaparadox

Reputation: 51

What about:

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

Upvotes: 5

tomtom
tomtom

Reputation: 31

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 a workaround, for me this worked:

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

Upvotes: 2

Related Questions