Skip to content

Commit 5b259cc

Browse files
rickeylevhugovkzanieb
authored
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Zanie Blue <contact@zanie.dev>
1 parent b959f24 commit 5b259cc

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

peps/pep-0796.rst

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Type: Standards Track
88
Created: 26-Jun-2025
99
Python-Version: 3.15
1010

11-
.. highlight:: rst
12-
1311

1412
Abstract
1513
========
@@ -42,7 +40,7 @@ requirement should be relaxed and relative path behavior allowed and defined.
4240

4341
Second, such relative paths are a building block to enable portable virtual
4442
environments, i.e. copying a virtual environment as-is between hosts of
45-
compatible platforms. Portable venvs are appealing because virtual environments
43+
compatible platforms. Portable virtual environments are appealing because virtual environments
4644
are a popular mechanism for running Python applications. This provides several
4745
benefits:
4846

@@ -60,7 +58,7 @@ host that intends to run the program.
6058
When the virtual environment doesn't require modifications to be usable, it
6159
also allows more advanced deployment mechanisms, e.g. remote mounting and
6260
caching of artifacts. While this PEP on its own isn't sufficient to enable
63-
that, it allows tools like ``bazel`` or ``venvstacks`` to more easily prepare
61+
that, it allows tools like Bazel or venvstacks to more easily prepare
6462
constrained environments that allow for such use cases.
6563

6664
Rationale
@@ -75,10 +73,10 @@ so other hook points (e.g. ``site`` initialization) never trigger.
7573

7674
Tools that currently look to enable virtual environment portability across
7775
machines do so either by relying on undocumented interpreter behaviour
78-
(``bazel``, omitting the ``home`` key entirely to trigger an implementation
76+
(Bazel, omitting the ``home`` key entirely to trigger an implementation
7977
dependent fallback to resolving via a symlinked interpreter binary on
8078
non-Windows systems) or by requiring a post-installation script to be executed
81-
after the environment is placed in its target location (``venvstacks``).
79+
after the environment is placed in its target location (venvstacks).
8280

8381
Specification
8482
=============
@@ -87,10 +85,10 @@ The ``home`` value in ``pyvenv.cfg`` is permitted to use a relative path value.
8785
These may contain up-references outside of the virtual environment root
8886
directory. Examples:
8987

90-
* ``subdir/whatever/bin`` (a directory within the virtual environment).
88+
* ``subdir/whatever/bin`` (a directory within the virtual environment)
9189
* ``./subdir/whatever/bin`` (same as above)
9290
* ``../../../../../elsewhere/runtime/bin`` (a directory outside the virtual
93-
environment).
91+
environment)
9492

9593
Relative paths are relative to the directory containing ``pyvenv.cfg``. During
9694
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
134132
paths.
135133

136134
A proof-of-concept of this is implemented in
137-
`rickeylev/feat.relative.pyvenv.home <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__
135+
`rickeylev/feat.relative.pyvenv.home <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__.
138136

139137
Backwards Compatibility
140138
=======================
141139

142140

143-
Tools that work around the absolute ``home`` key limitation the way ``bazel``
144-
and ``venvstacks`` currently do (omitting the ``home`` key, or editing it after
141+
Tools that work around the absolute ``home`` key limitation the way Bazel
142+
and venvstacks currently do (omitting the ``home`` key, or editing it after
145143
moving the environment) will be unaffected.
146144

147145
While the PEP author and sponsor aren't aware of any projects that work around
@@ -190,12 +188,12 @@ References
190188
host-relocatable virtual environments.
191189
* `rules_py <https://github.com/aspect-build/rules_py>`__: implements
192190
host-relocatable virtual environments.
193-
* `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`__:
191+
* `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`__
194192
* `venvstacks <https://pypi.org/project/venvstacks/>`__: a tool for creating reproducible distribution artifacts from virtual environments
195193
A relocatable Python runtime.
196194
* `PoC for relative home in Python startup <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__
197195
* `Python Ideas "Making venvs relocatable friendly" discussion <https://discuss.python.org/t/making-venvs-relocatable-friendly/96177>`__
198-
* `GH-136051: relative pyvenv.cfg home <https://github.com/python/cpython/issues/136051>`__
196+
* `gh-136051: relative pyvenv.cfg home <https://github.com/python/cpython/issues/136051>`__
199197

200198
Rejected Ideas
201199
=====================

0 commit comments

Comments
 (0)