-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 796: Relative Virtual Environments #4476
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
Open
rickeylev
wants to merge
38
commits into
python:main
Choose a base branch
from
rickeylev:relative.venvs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
ceeaa3b
initial file
rickeylev d0a9289
add some core content
rickeylev 41d2ea8
rename to motivation
rickeylev 65a415c
note it enables more advanced optimizations
rickeylev 4175b20
add foot notes, relocatable term section, links
rickeylev bbc85b7
update discussion, sponsor headers to pending
rickeylev a0c2529
rst fixups
rickeylev 8e6e21e
fixup italics
rickeylev 37202ca
rename to relative-venv
rickeylev b81c50f
clarify advanced deployment options, reflow some text
rickeylev 55a5e28
add specification, rationale section; doc why env vars arent an option
rickeylev e09b00d
also mention curdir syntax handling
rickeylev c7a6a9b
update some todo text
rickeylev bc1ffbd
update codeowners
rickeylev 2301d2a
add initial discussion footnote link
rickeylev e14b01f
add fr footnote
rickeylev 175f378
revert codeowners change
rickeylev 31cb756
remove packaging-related specs
rickeylev cd46f4d
fix lint errors with headers
rickeylev b532f5c
set sponsor
rickeylev 99434fc
set sponsor as codeowner
rickeylev 862142a
clarify title to focus on core pyvenv.cfg home behavior
rickeylev 1c8fb2d
fix typo; remove host-relocatable mention; remove non-germane copying…
rickeylev c542890
fix typos, grammar
rickeylev 3240227
Apply suggestions from code review
rickeylev 557cb71
fix up markdown and text width
rickeylev 0579623
fix title underlines
rickeylev c9388b3
link to relative venv reference implementation
rickeylev b959f24
Apply suggestions from code review
rickeylev 5b259cc
Apply suggestions from code review
rickeylev 560dadb
Merge branch 'main' of https://github.com/python/peps into relative.v…
rickeylev f41ed51
Merge branch 'relative.venvs' of https://github.com/rickeylev/peps in…
rickeylev 5cbc9f5
better answer why/how relvenvs help; wrap some long lines
rickeylev 0af0eea
Apply AA-Turner suggestions
rickeylev 68dd5e0
add refs, remove CWD acronym, fix grammar
rickeylev b50a80c
address review comments: better split and organize rationale/motivation
rickeylev af8f880
Merge branch 'main' into relative.venvs
AA-Turner ae5a67f
Apply markup and simple grammar fixes from code review
ncoghlan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Zanie Blue <[email protected]>
- Loading branch information
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,8 +8,6 @@ Type: Standards Track | |||||||
| Created: 26-Jun-2025 | ||||||||
| Python-Version: 3.15 | ||||||||
|
|
||||||||
| .. highlight:: rst | ||||||||
|
|
||||||||
|
|
||||||||
| Abstract | ||||||||
| ======== | ||||||||
|
|
@@ -42,7 +40,7 @@ requirement should be relaxed and relative path behavior allowed and defined. | |||||||
|
|
||||||||
| Second, such relative paths are a building block to enable portable virtual | ||||||||
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| environments, i.e. copying a virtual environment as-is between hosts of | ||||||||
| compatible platforms. Portable venvs are appealing because virtual environments | ||||||||
| compatible platforms. Portable virtual environments are appealing because virtual environments | ||||||||
| are a popular mechanism for running Python applications. This provides several | ||||||||
| benefits: | ||||||||
|
|
||||||||
|
|
@@ -60,7 +58,7 @@ host that intends to run the program. | |||||||
| When the virtual environment doesn't require modifications to be usable, it | ||||||||
| also allows more advanced deployment mechanisms, e.g. remote mounting and | ||||||||
| caching of artifacts. While this PEP on its own isn't sufficient to enable | ||||||||
| that, it allows tools like ``bazel`` or ``venvstacks`` to more easily prepare | ||||||||
| that, it allows tools like Bazel or venvstacks to more easily prepare | ||||||||
| constrained environments that allow for such use cases. | ||||||||
|
|
||||||||
| Rationale | ||||||||
|
|
@@ -75,10 +73,10 @@ so other hook points (e.g. ``site`` initialization) never trigger. | |||||||
|
|
||||||||
rickeylev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| Tools that currently look to enable virtual environment portability across | ||||||||
| machines do so either by relying on undocumented interpreter behaviour | ||||||||
| (``bazel``, omitting the ``home`` key entirely to trigger an implementation | ||||||||
| (Bazel, omitting the ``home`` key entirely to trigger an implementation | ||||||||
| dependent fallback to resolving via a symlinked interpreter binary on | ||||||||
| non-Windows systems) or by requiring a post-installation script to be executed | ||||||||
| after the environment is placed in its target location (``venvstacks``). | ||||||||
| after the environment is placed in its target location (venvstacks). | ||||||||
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| Specification | ||||||||
| ============= | ||||||||
|
|
@@ -87,10 +85,10 @@ The ``home`` value in ``pyvenv.cfg`` is permitted to use a relative path value. | |||||||
| These may contain up-references outside of the virtual environment root | ||||||||
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| directory. Examples: | ||||||||
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| * ``subdir/whatever/bin`` (a directory within the virtual environment). | ||||||||
| * ``subdir/whatever/bin`` (a directory within the virtual environment) | ||||||||
| * ``./subdir/whatever/bin`` (same as above) | ||||||||
| * ``../../../../../elsewhere/runtime/bin`` (a directory outside the virtual | ||||||||
| environment). | ||||||||
| environment) | ||||||||
|
|
||||||||
| Relative paths are relative to the directory containing ``pyvenv.cfg``. During | ||||||||
| interpreter startup (i.e. ``getpath.py``), the relative path is joined to the | ||||||||
|
|
@@ -134,14 +132,14 @@ helpers already present for checking if a path is absolute and joining two | |||||||
| paths. | ||||||||
|
|
||||||||
| A proof-of-concept of this is implemented in | ||||||||
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| `rickeylev/feat.relative.pyvenv.home <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__ | ||||||||
| `rickeylev/feat.relative.pyvenv.home <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__. | ||||||||
|
||||||||
| `rickeylev/feat.relative.pyvenv.home <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__. | |
| `rickeylev/feat.relative.pyvenv.home | |
| <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__. |
Please could you also wrap some of the other long lines to 79 chars?
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
rickeylev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ncoghlan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ncoghlan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ncoghlan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ncoghlan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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.
Uh oh!
There was an error while loading. Please reload this page.