-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
uv exports incomplete requirements if using external packages #7496
Comments
Can you clarify what the expected behavior is? We should write the index URL into the exported file? |
Yes. The requirements file should have the --extra-index-url flag if one wishes to use pip install |
I don't think we should do this by default, but maybe we could include |
Shouldn't uv export > ../another_directory/requirements.txt
cd ../another_directory
uv venv .venv
.venv\Scripts\activate
uv pip install -r requirements.txt Output:
The export help file currently specifies it as "Export the project's lockfile to an alternate format". IMO it's to be expected that the output should be as close a match of the lockfile as possible. The output I showed isn't, as it won't even generate a working environment using any form of index behavior, be it uv or pip, while the lockfile does. |
I don't think passing settings inside the I understand this isn't ideal and we may be able to make it better somehow, but it's not a simple problem. |
I understand the concern. Well, keeping the behavior as is, this maybe warrants a warning of some kind, either when the engine detects a package only available in a non-default index or simply when there are extra indexes in the lockfile, so this behavior is more explicit. |
|
I understand, but both |
Hello @Mateuscvieira, The following commands do the job for me. uv venv
uv pip install --index https://downloads.ceicdata.com/python ceic_api_client Please let me know if that is what you need. In addition to that, I have couple of more questions to raise here:
Apologies for the long list of questions but the discussed topic is very interesting. |
I'll chime in supporting this. For my use case, I'm trying to export a requirements.txt file that I can pass to a remote Apache Ray cluster. Running My current workaround is to just manually edit the |
when running tests with tox that install dependencies from requirements.txt files. Workaround for astral-sh/uv#7496 .
when running tests with tox that install dependencies from requirements.txt files. Workaround for astral-sh/uv#7496 .
I would also really appreciate support for this feature. I want to generate Either just |
+1 to adding |
This issue is linked to #7494 but doesn't have the same solution, or any solution I have found.
The problem
I can start my uv project with commands:
uv init uv add "ceic-api-client<=2.7" --extra-index-url https://downloads.ceicdata.com/python
Then appending the extra index to the pyproject file like so:
This creates an environment where I can freely add, remove, run, sync and lock. So, running
uv export
, I would expect a valid requirements file, but I get the following (using the no-hashes flag for legibility):This, for obvious reasons, will not build.
Suggestions
Maybe this is unwarranted advice, but from what I understand from src/commands/project/export.rs, the export command reads from the lockfile, not pyproject. Well, as mentioned in #7494, the lockfile is in fact correct when it comes to extra indexes, so it wouldn't require adding full support for adding indexes in
add
to fix this issue withexport
(I think).Versions
Running uv 0.4.11 in Windows 10
The text was updated successfully, but these errors were encountered: