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

Inconsistent behavior in a virtual project with empty dependencies #1381

Open
ChaserZ98 opened this issue Sep 13, 2024 · 0 comments
Open

Inconsistent behavior in a virtual project with empty dependencies #1381

ChaserZ98 opened this issue Sep 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ChaserZ98
Copy link

Steps to Reproduce

  1. Create a virtual project using rye init --virtual virtual_project.
  2. Go into the virtual project directory with cd virtual_project.
  3. Run sync using rye sync.
  4. Add any dependency using rye add. For example, rye add aiohttp.
  5. Remove the installed dependency with rye remove aiohttp.
  6. Run rye list to list installed dependencies.

Expected Result

The command rye list shouldn't display anything since we remove the only dependency. And no dependency should be listed in pyproject.toml, requirements.lock and requirements-dev.lock.

Actual Result

There is no dependency listed in pyproject.toml, requirements.lock and requirements-dev.lock. However, the command rye list still shows the dependencies of the removed package.

What's more, if you try to add other package now, you will find that rye shows the record of removing the dependencies of the previously removed packages. This means that rye didn't remove them but kept them in the virtual environment until the new package is added.

I personally guess it might be an upstream problem from uv when dealing with empty dependencies as it shows the following warning when I remove the last dependency. And such a warning also appears when you first did rye sync on the virtual project.

warning: Requirements file requirements-dev.lock does not contain any dependencies
No requirements found (hint: use `--allow-empty-requirements` to clear the environment)

Version Info

rye 0.39.0
commit: 0.39.0 (bf3ccf8 2024-08-21)
platform: linux (x86_64)
self-python: [email protected]
symlink support: true
uv enabled: true

Stacktrace

No response

@charliermarsh charliermarsh added the bug Something isn't working label Sep 29, 2024
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

No branches or pull requests

2 participants