uv: `uv pip compile` does not add `extra-index-url` to the generated output file
I think #1143 was only about parsing it from an existing input file. Running pip-compile
will add this flag (and probably others) to the generated output.
While testing uv
, I haven’t found out how to do this or if it’s just missing.
uv
uv pip compile \
pyproject.toml \
--output-file requirements.txt \
--extra-index-url=https://private.example.com/pypi
Generates:
# This file was autogenerated by uv v0.1.2 via the following command:
# uv pip compile pyproject.toml --output-file requirements.txt --extra-index-url=https://private.example.com/pypi
pip-compile
pip-compile \
--output-file requirements.txt \
--extra-index-url=https://private.example.com/pypi
Generates:
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra-index-url=https://private.example.com/pypi
#
--extra-index-url https://private.example.com/pypi
Adding --extra-index-url ...
to the requirements file would allow one to run uv pip sync requirements.txt
without having to add the cli argument.
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Reactions: 1
- Comments: 32 (11 by maintainers)
Furthermore, it doesn’t use/manage
PIP_EXTRA_INDEX_URL
environment variable configuration aspip
does too.With
UV_EXTRA_INDEX_URL=https://**:****@****.pkgs.visualstudio.com/_packaging/***/pypi/simple/ges/pypi/simple/
set the command is just:without the env var, the command is:
and the result is for both:
We use Microsoft’s DevOps Artifacts for mirroring PyPI
I’m waiting for this to be fixed as well. Else the resolution with index-url + extra-index-url is not working with
uv compile
vspip-compile
one.@hofrob The answer is No.
mylib
is not using the same name as another library on PyPI.Hello @zanieb
Thanks for your answer.
I’ve just tried adding
UV_EXTRA_INDEX_URL
. I’m using uv0.1.5
and I have the following error still:mylib==2024.01.01
is a lib in my private pypi repository. It seems it doesn’t useUV_EXTRA_INDEX_URL
as well.Can you try passing
--emit-index-url
on the command-line?I think it would help if you shared the exact command you are running except for any secrets, and if you stick the verbose compilation log in a gist and share that too, I’m sure that would be helpful.
Edit: Sorry, I see you shared it above!
me 2, it’s the only thing that blocks me and my team to fully switch to uv and we’d like to do as soon as this will be fixed and released
yup, only into private registry it doesn’t exist at all on pypi , so no risk of naming conflicts
For clarity, this issue is now focused on whether we want to change our defaults around emitting index URLs.
@thomasaarholt - I filed your other issue here, thanks! https://github.com/astral-sh/uv/issues/2035
@thomasaarholt – Unrelated to this issue, but heads up: if you’re using Gemfury, you need to use
pypi.fury.io
instead ofrepo.fury.io
in your index URL. Gemfury relies on the User Agent to do that mapping, and we (of course) don’t sendpip
in our User Agent:@charliermarsh –
mylib
is not on PyPI. It’s a private lib/dependency only available from our private pypi repo. The resolution is working well withpip-compile
frompip-tools
withPIP_EXTRA_INDEX_URL
environment variable setup.You can use
UV_EXTRA_INDEX_URL
instead. We are hesitant to read pip’s configuration directly.There are two more related issues here
unsupported environment variables
uv
doesn’t support environment variables when the extra index url is supplied inrequirements.in
(it does work when passed via the--extra-index-url
cli argument). With the followingrequirements.in
file:generates
uv
doesn’t find private packages?uv
doesn’t find our company package calledtesty-foobar
, whilepip-compile
does. With the followingrequirements.in
file:uv
generates
pip-compile
generates
Yes, that works. It will add the default
index-url
too which makes sense. Thanks!I guess this could be the default behavior?