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

Python venv overwritten when using uv.sync.enable and venv.enable #1712

Open
LorenzBischof opened this issue Feb 10, 2025 · 1 comment · May be fixed by #1713
Open

Python venv overwritten when using uv.sync.enable and venv.enable #1712

LorenzBischof opened this issue Feb 10, 2025 · 1 comment · May be fixed by #1713
Labels
bug Something isn't working

Comments

@LorenzBischof
Copy link

LorenzBischof commented Feb 10, 2025

Describe the bug
When using languages.python.uv.sync.enable = true and languages.python.venv.enable = true the devenv:python:virtualenv task, that runs after devenv:python:uv recreates the virtualenv with uv venv $DEVENV_STATE/venv.

The behavior only appears initially when the virtualenv is created. When reloading the shell the virtualenv is not recreated, because it already exists and uv sync is run again, because the uv.sync.checksum file was deleted.

Expected behavior
When setting both options the virtualenv should only be sourced and not recreated.

To reproduce
The following test exhibits the same problem:

venv.enable = true;

However for some reason the test itself passes when run with devenv-run-tests --only python-uv-sync. To reproduce the problem run cd tests/python-uv-sync && ../../result/bin/devenv shell:

$ python -c 'import requests'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'

Version

devenv 1.3.1 (x86_64-linux)

Also tested with f8be0ed and with uv 0.5.29 (unstable) and 0.4.30 (rolling).

Related: #1626

@LorenzBischof LorenzBischof added the bug Something isn't working label Feb 10, 2025
@domenkozar
Copy link
Member

Would be great if someone adds a test and fixes this one :)

@LorenzBischof LorenzBischof linked a pull request Feb 11, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants