-
Notifications
You must be signed in to change notification settings - Fork 582
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
Bugs in the activate_this.py script created by uv venv #3346
Comments
Thanks, we vendored these from virtualenv and looks like the first one at least was fixed: pypa/virtualenv#2651 |
The second looks like our bug. |
There's some other weirdness as well.
Isn't that just exactly equivalent to this? os.environ["VIRTUAL_ENV_PROMPT"] = os.path.basename(base) uv/crates/uv-virtualenv/src/activator/activate_this.py Lines 53 to 54 in 1089abd
Isn't that exactly equivalent to this? site.addsitedir(path)
sys.path[:] = sys.path[prev_length:] + sys.path[:prev_length] |
I think some parts were lost when copying the upstream (https://github.com/pypa/virtualenv/blob/01cc6fbeb9f6e4a261d3bcf292801d5959525870/src/virtualenv/activation/python/activate_this.py), i'll give this a proper a look on monday. |
## Summary Refreshes some of the activation scripts, and fixes some bugs in `activate_this.py` that were likely the rest of some erroneous copy-pasting. Closes #3346. ## Test Plan ``` ❯ python Python 3.12.0 (main, Feb 28 2024, 09:44:16) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import httpx Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'httpx' >>> activator = '.venv/bin/activate_this.py' >>> with open(activator) as f: ... exec(f.read(), {'__file__': activator}) ... >>> import httpx ```
If I do
uv venv
, the file.venv/Scripts/activate_this.py
contains errors:Too many closing parentheses:
Invalid backslash escapes (this is on Windows):
The text was updated successfully, but these errors were encountered: