Skip to content

Detect broken virtual environments when moved #13989

@zanieb

Description

@zanieb

We can read the beginning of all entrypoints we created (through entry_points.txt) and if any of them points to a python interpreter that doesn't exist, we invalidate the environment. There are some details to be figured out around perf and where the scripts come from, e.g. we don't cover non-entrypoint scripts (I don't think we keep a record of #!python script we rewrote vs. script where the shebang was user-provided).

Another approach is recording the venv location (either pyvenv.cfg or a different file we create, iirc it's not recorded yet anywhere) and invalidating it if the original location and the current location aren't the same directory (usually, because the original location doesn't exist anymore, but we want to allow symlinks above the .venv).

Originally posted by @konstin in #13196

In projects, we can invalidate and recreate these environments. In other contexts, we can improve our error messages or warn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions