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

uv pip sync fails to clear environment when given an empty requirements list #4516

Closed
ncoghlan opened this issue Jun 25, 2024 · 4 comments · Fixed by #4517
Closed

uv pip sync fails to clear environment when given an empty requirements list #4516

ncoghlan opened this issue Jun 25, 2024 · 4 comments · Fixed by #4517
Labels
enhancement New feature or improvement to existing functionality

Comments

@ncoghlan
Copy link

I have a use case where several different environments are being updated with uv pip sync, and some of those environments may legitimately have a desired end state of "just a Python runtime with no extra packages" (the packages that are installed into those environments are platform dependent, and on some platforms there are no additional packages needed).

When trying to clear those environments, uv pip sync simply reports "No requirements found" and exits immediately instead of synchronising the environment with the requirements list as desired.

I can work around this, but being able to reliably clear an environment from outside was a key motivation for switching from pip-sync to uv pip sync (due to jazzband/pip-tools#2103)

@zanieb
Copy link
Member

zanieb commented Jun 25, 2024

Hi! The request makes sense but this is a tough one for user experience because people can pass all sorts of requirements sources and we've seen people confused when they accidentally have an empty set of requirements. Do you think we should add a flag to opt-in to this behavior?

@zanieb zanieb added the needs-design Needs discussion, investigation, or design label Jun 25, 2024
@ncoghlan
Copy link
Author

Yeah, an opt-in flag like --allow-clear would make sense (I assumed the UX benefit was the reason for the current behaviour)

@zanieb
Copy link
Member

zanieb commented Jun 25, 2024

Here's a proof of concept: #4517

@zanieb zanieb added enhancement New feature or improvement to existing functionality and removed needs-design Needs discussion, investigation, or design labels Jun 25, 2024
@ncoghlan
Copy link
Author

That would definitely work for my use case, and the name --allow-empty-requirements seems clear enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants