-
Notifications
You must be signed in to change notification settings - Fork 57
Description
If running the command poetry export --format requirements.txt --output requirements.txt with a poetry project that defines a default source as well as other sources, e.g.:
[[tool.poetry.source]]
name = "primary-pypi"
url = "https://private-primary/pypi/simple"
default = true
[[tool.poetry.source]]
name = "secondary-pypi"
url = "https://private-secondary/pypi/simple"The resulting requirements.txt has the index-url and extra-index-url flags defined at the top of the file as such:
--extra-index-url https://private-primary/pypi/simple
--index-url https://private-secondary/pypi/simple
This is intended behaviour, as can be seen in test case test_exporter_exports_requirements_txt_with_default_and_secondary_sources.
However, because the extra-index-url is specified before index-url, pip does not recognise it when running the pip install --user -r requirements.txt. I can verify this because when I have a package in the secondary-pypi that's not in the primary-pypi, pip cannot find any versions of the package until I manually edit the requirements.txt file to switch the order of the flags (i.e. having index-url defined in the first line and extra-index-url defined below that). Once I re-order the flags in requirements.txt pip installs the defined packages without issue.