Skip to content

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

@ella-rowe

Description

@ella-rowe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions