uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv pip compile`: Add a nicer (more automated) way of dealing with multiple files (e.g. main + dev dependencies)

Open ThiefMaster opened this issue 1 year ago • 1 comments

I suggested this in a comment on another issue but maybe this deserves its own issue since it's quite a bit more than what I suggested in that issue itself:

How about a uv pip compile --auto mode that looks for requirements*.{in,txt}, checks if there are dependencies between them (e.g. -c requirements.txt in a requirements.something.in), and then compiles them in the proper order?

This would also be REALLY amazing for upgrades. Imagine just being able to uv compile --auto --upgrade-package somepackage if you want to upgrade that package, and uv then automatically updates it in your main dependencies and/or dev dependencies, depending on where it's defined :)

ThiefMaster avatar Feb 16 '24 09:02 ThiefMaster

At the moment we work with a requirements.txt and a requirements-dev.txt. On a local dev system one will install the venv using both requirements files. Installing into a production Docker container, only the requirements.txt will be installed.

I came here while looking into if uv supports this use-case, and I'm not sure. Also not sure if this issue is addressing the same use-case. Some confirmation would be helpful @charliermarsh.

I did not yet play around with uv, only read the docs. I assume one would need to specify two requirements.in files? I do like the approach of the javascript world where both type of dependencies are defined in the package.json but with separate keys and it is possible to build for a target env (dev vs. prod). Given uv will work on a .lock file, I wonder if this will incorporate this use case and provide independent/dependent package resolutions. Installing the dev dependencies should not change versions on the main application dependencies etc. I have no insight on how this is done in package.json/package-lock.json, but I imagine that managing this package resolution isn't easy.

I hope this use-case is clear and something uv will consider to support. If it's not clear, I'm happy to expand. If it requires a separate issue to this one, I'm happy to create a new issue.

Spenhouet avatar Apr 20 '24 07:04 Spenhouet