Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index-url and extra-index-url in wrong order #149

Closed
ella-rowe opened this issue Oct 12, 2022 · 3 comments · Fixed by #270 · May be fixed by pypa/pip#11621
Closed

index-url and extra-index-url in wrong order #149

ella-rowe opened this issue Oct 12, 2022 · 3 comments · Fixed by #270 · May be fixed by pypa/pip#11621

Comments

@ella-rowe
Copy link

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.

@dimbleby
Copy link
Contributor

Sounds like a pip bug - I don't see any hint in https://pip.pypa.io/en/stable/reference/requirements-file-format/ that the order of these lines should matter.

If you agree - and are sure that this is really the problem - suggest raising a bug with pip saying that this should not make any difference.

@ella-rowe
Copy link
Author

Sounds like a pip bug - I don't see any hint in https://pip.pypa.io/en/stable/reference/requirements-file-format/ that the order of these lines should matter.

If you agree - and are sure that this is really the problem - suggest raising a bug with pip saying that this should not make any difference.

Agreed. I have lodged an issue on pip. I'll close this issue, and will re-open if pip decides this is a "feature not a bug" (in which case, the fix on their end will be to clarify this in their documentation).

@colindean
Copy link

I thought that this might have been fixed in Poetry 1.5.1 with the migration away from default/secondary, but it's not. I'm frustrated to see it's more of a pip problem, too.

Our default repo, which we had set to default = false, we've had to set to priority = "primary" in order to get the same requirements.txt output and keep in place our manual override of the default in pip settings to keep our builds from talking to PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants