Poetry: Support multiple sources

Created on 13 Jun 2018  路  7Comments  路  Source: python-poetry/poetry

poetry only searches one source added in the tool.poetry.source section, is there a way to allow adding multiple sources?

Most helpful comment

is there any way to use different PyPIs for different packages?

All 7 comments

What do you mean exactly?

You can specify as many sources as you want in the pyproject.toml file.

I'm using poetry 0.10.3, running poetry add pyside2 results in

[ValueError]
No package named "pyside2"

using this pyproject file:

[[tool.poetry.source]]
name = 'default'
url = 'https://pypi.org/'

[[tool.poetry.source]]
name = 'qt'
url = 'http://download.qt.io/snapshots/ci/pyside/5.11/latest/'

[tool.poetry.dependencies]
python = ">=3.6"
toml = "^0.9.4"
requests = "^2.18"
python-mpv = "^0.3.8"

[tool.poetry.dev-dependencies]
pytest = ">=3.5"
flake8 = "^3.5"

@MaT1g3R looks like we're on the same path. Once you get past multiple sources issue, you'll hit issue with using repository served on http https://github.com/sdispater/poetry/issues/230

Hi, I'm not fully understand how poetry works with multiple sources.

If I put following sources in my pyproject file:

[tool.poetry.dependencies]
my-package="^0.1.0"

[[tool.poetry.source]]
name = 'my-local-pypi'
url = 'http://localhost/simple/'

[[tool.poetry.source]]
name = 'my-remote-pypi'
url = 'http://remote-pypi.com/simple/'

and run poetry update, I see only one of these sources in my lock file. But it's important to me to keep both sources in lock file because my-package can be installed from any source depending on current environment.

I thought I can solve it with PIP_EXTRA_INDEX_URL="http://localhost/simple/ http://remote-pypi.com/simple/" and completely remove sources from pyproject file. But in that case I'm not able to install my-package at all.

So could someone please explain me how can I fix that problem?

The lock file is a record of whatever is downloaded. If you can't see the "fallback" repository inside the lock file, it just means that it wasn't needed when the lock file was updated. Future poetry updates will still take from the fallback if necessary.

If the sources will be changing very often and unpredictably then it might be in your best interest to ignore the lock file, though that is a sign of something that you could fix on the repository's end.

@xsduan thanks. I've fixed that by using one source.

is there any way to use different PyPIs for different packages?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AWegnerGitHub picture AWegnerGitHub  路  3Comments

etijskens picture etijskens  路  3Comments

EdgyEdgemond picture EdgyEdgemond  路  3Comments

probablykasper picture probablykasper  路  3Comments

mozartilize picture mozartilize  路  3Comments