✨ feat(create): record created environments per PEP 832 - #3204
Draft
gaborbernat wants to merge 1 commit into
Draft
✨ feat(create): record created environments per PEP 832#3204gaborbernat wants to merge 1 commit into
gaborbernat wants to merge 1 commit into
Conversation
Editors and type checkers have no standard way to find a project's environments without an activated shell, so each one hard-codes a search per tool that creates environments. PEP 832 replaces that with a .python-envs file whose last line names the default environment. virtualenv creates environments, so it covers the write half. After creation it records the destination in the .python-envs file of the parent folder and moves any existing entry for it to the end, making the fresh environment the default. A destination named .venv is left alone, since the PEP counts it as the implicit last line. A read or write failure warns and leaves the environment usable. Pass --no-python-envs to opt out. Recording rewrites the whole file, which loses entries when several environments land in one folder at once: eight concurrent creations dropped between one and four of them on every attempt. The read-modify-write therefore runs under a .python-envs.lock file next to the recorded one. Locking beside the resource rather than inside the app data folder holds the guarantee when the app data is read-only or disabled, and gives any other PEP 832 writer a location to agree on. Documented across all four Diataxis dimensions, including a new reference page cataloguing every file virtualenv writes inside and beside an environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Editors and type checkers have no standard way to find a project's environments without an activated shell, so each one hard-codes a search per tool that creates environments. PEP 832 addresses that with a
.python-envsfile listing one environment per line, where the last line names the default environment and a.venvfolder alongside counts as the implicit last line.virtualenv creates environments, so this covers the write half. After creation it records the destination in the
.python-envsfile of the parent folder and moves any existing entry for it to the end, making the fresh environment the default. It leaves a destination named.venvalone, since the PEP treats it as the implicit last line. A read or write failure warns and leaves the environment usable. Pass--no-python-envsto opt out.Rewriting the whole file loses entries when several environments land in one folder at once. Eight concurrent creations dropped between one and four of them on every attempt, so the read-modify-write runs under a
.python-envs.lockfile next to the recorded one. 🔒 Locking beside the resource rather than inside the app data folder holds the guarantee when the app data is read-only or disabled, and gives any other PEP 832 writer a location to agree on.