Skip to content

Commit 6822259

Browse files
authored
PEP 832: some clarifications based on feedback (#5142)
1 parent e03cf3e commit 6822259

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

‎peps/pep-0832.rst‎

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,14 @@ logical paths should be resolved to their physical equivalent before use.
8888

8989
Instead of a directory containing a virtual environment, the root of a project
9090
MAY have a :file:`.venv` redirect file. This file acts as a pointer to where
91-
the (current) virtual environment to be used for the project is located. This
92-
virtual environment may not be the only environment associated with the
91+
the (current) virtual environment to be used for the project is located
92+
(which, just like a :file:`.venv` directory, can be a logical or pysical path).
93+
This virtual environment may not be the only environment associated with the
9394
project, but it is considered the preferred virtual environment to use
9495
*at the moment* by other tools. The tool managing the virtual environment
9596
SHOULD update any :file:`.venv` redirect file as appropriate when the tool or
9697
the user desire a different virtual environment to be used by default by other
97-
tools. As well, other tools that did not initially create the :file:`.venv`
98-
redirect file SHOULD NOT overwrite it without the user somehow expressing a
99-
desire for the change of "ownership" of the file.
98+
tools.
10099

101100
Tools looking for a virtual environment SHOULD look for either a :file:`.venv`
102101
directory or a :file:`.venv` redirect file. IF a tool chooses to search parent
@@ -108,10 +107,10 @@ either ``\n`` or ``\r\n`` is allowed and MUST be ignored. An empty file or one
108107
that only contains a newline is considered invalid.
109108

110109
The line in the :file:`.venv` redirect file MUST point to a directory
111-
containing a virtual environment. The path MAY use POSIX path separators--
112-
``/`` --regardless of what the operating system's native path separator is.
113-
The path MAY be relative, and if so MUST be relative to the directory
114-
containing the :file:`.venv` file.
110+
containing a virtual environment when being written. The path MAY use POSIX
111+
path separators-- ``/`` --regardless of what the operating system's native path
112+
separator is. The path MAY be relative, and if so MUST be relative to the
113+
directory containing the :file:`.venv` file.
115114

116115
With regard to committing a :file:`.venv` redirect file to version control, it
117116
MAY be done when the location of the virtual environment is considered static
@@ -127,9 +126,10 @@ by this PEP.
127126
IF a tool can detect that an environment is already in use (e.g. the
128127
``VIRTUAL_ENV`` environment variable is set), THEN tools SHOULD respect the
129128
user's choice and use the activated/in-use environment over the default
130-
environment when no previous environment selection has occurred. Tools MAY
131-
choose to override even a previous environment selection if an environment is
132-
detected as activated/in use.
129+
environment when no previous environment selection has occurred or the tool
130+
doesn't have its own justification for ignoring the user's supposed choice.
131+
Tools MAY choose to override even a previous environment selection if an
132+
environment is detected as activated/in use.
133133

134134
This PEP is choosing NOT to take a position on what to do if :file:`.venv` is
135135
invalid (whether it's a directory or a file). It is up to the tool encountering
@@ -465,6 +465,15 @@ this PEP.
465465
Change History
466466
==============
467467

468+
- 24-Sep-2026
469+
470+
- Clarify :file:`.venv` redirect files can be logical or physical paths just
471+
like :file:`.venv` directories
472+
- Specify that tool can ignore supposed user selections if the tool has a
473+
justification to
474+
- Clarify that :file:`.venv` redirect files have to be valid paths
475+
**when written**; this can't really be enforced upon reading
476+
468477
- 08-Sep-2026
469478

470479
- Switch back to :file:`.venv` redirect files from :file:`.python-envs` files

0 commit comments

Comments
 (0)