Closed nsoranzo closed 6 months ago
I think the proper solution is to also add for each primary after the first an --extra-index-url URL line
Actually, that's what is done. See https://github.com/python-poetry/poetry-plugin-export/blob/main/tests/test_exporter.py#L1792
Probably, there is something special about PyPI that is not handled correctly.
Thanks for the quick reply @radoering ! I've done a quick test by amending the second primary package source to not look like PyPI:
[[tool.poetry.source]]
name = "foo"
url = "https://pypi.python.org/simple"
priority = "primary"
and after running poetry lock --no-update
and poetry export -f requirements.txt --without-hashes --output requirements.txt
the output file starts with:
--extra-index-url https://pypi.python.org/simple
--index-url https://wheels.galaxyproject.org/simple
which seems to also not work in this order (i.e. --index-url
should come before --extra-index-url
).
e.g. adding the following line fixes the issue for us:
--extra-index-url https://pypi.python.org/simple
I chose a different approach in #270. Since pip does not care about order by design (see pypa/pip#8606 for details), it does not matter which source is the --index-url
and which is the --extra-index-url
and since PyPI is the default --index-url
, I chose to just not set --index-url
if PyPI is among the sources. (That's what it was before the last release anyway.)
which seems to also not work in this order (i.e. --index-url should come before --extra-index-url).
That's actually a pip bug. See #149. But since it is easy to make sure that --index-url
comes first, I also changed it in #270.
For a project I work on, we have a different package source configured as
primary
(since poetry deprecateddefault
) with PyPI as second primary, as recommended in https://python-poetry.org/docs/repositories/ .This is the relevant section of our
pyproject.toml
:When exporting with
poetry export -f requirements.txt --without-hashes --output requirements.txt
the output file starts with just:so when trying to install the project dependencies from this file, it fails with:
Before the merge of https://github.com/python-poetry/poetry-plugin-export/pull/263 , the file started with:
and it worked fine. I think the proper solution is to also add for each primary after the first an
--extra-index-url URL
line, e.g. adding the following line fixes the issue for us: