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 from requirements.txt is ignored #1692

Closed
framillien opened this issue Feb 19, 2024 · 6 comments · Fixed by #1719
Closed

--index-url from requirements.txt is ignored #1692

framillien opened this issue Feb 19, 2024 · 6 comments · Fixed by #1719
Assignees
Labels
bug Something isn't working

Comments

@framillien
Copy link

framillien commented Feb 19, 2024

--index-url is ignored in requirements.txt, no issue with --extra-index-url parameter.

Look like it's related to the way IndexUrl argument is used. This argument is always initialized with a value (here) and combine always keep the previous value if present (here).

If I invert the expression in combine, my --index-url in requirements.txt is correctly used; but this is maybe not the expected way to fix it because command line parameter (if really defined) should take precedence ?

This affect both pip install and pip compile commands.

Fail with this requirements.txt:

--index-url https://my-pip-index.org/artifactory/api/pypi/pypi-custom-release/simple/

my-custom-package

Work with:

--extra-index-url https://my-pip-index.org/artifactory/api/pypi/pypi-custom-release/simple/

my-custom-package

With both commands:

uv -v --no-cache pip install requirements.txt
uv -v --no-cache pip compile requirements.in

To set the --index-url, the current workaround is to always set in on command line like:

uv -v --no-cache pip install --index-url https://my-pip-index.org/artifactory/api/pypi/pypi-custom-release/simple/ requirements.txt
@charliermarsh
Copy link
Member

Will take a look, thanks!

@charliermarsh charliermarsh added the bug Something isn't working label Feb 19, 2024
@framillien
Copy link
Author

(description edited because it's more related to arguments default values rather than IndexLocations default values)

@PetterS
Copy link

PetterS commented Feb 19, 2024

Is it possible to add a private PyPI in the pyproject.toml in a standardized way that uv understands? That is quite important in many corporate settings. poetry supports this via the non-standard [[tool.poetry.source]] so that works well for corporations.

@zanieb
Copy link
Member

zanieb commented Feb 19, 2024

Not yet, but we will support persistent configuration of registries in the future.

@framillien
Copy link
Author

Thanks for the quick fix

charliermarsh added a commit that referenced this issue Feb 20, 2024
## Summary

When we read `--index-url` from a `requirements.txt`, we attempt to
respect the `--index-url` provided by the CLI if it exists.
Unfortunately, `--index-url` from the CLI has a default value... so we
_never_ respect the `--index-url` in the requirements file.

This PR modifies the CLI to use `None`, and moves the default into logic
in the `IndexLocations `struct.

Closes #1692.
@PetterS
Copy link

PetterS commented Feb 20, 2024

Not yet, but we will support persistent configuration of registries in the future.

@zanieb is there a tracking issue for that feature I can subscribe to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants