Skip to content

Commit 5cbc9f5

Browse files
committed
better answer why/how relvenvs help; wrap some long lines
1 parent f41ed51 commit 5cbc9f5

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

peps/pep-0796.rst

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,20 @@ requirement should be relaxed and relative path behavior allowed and defined.
4040

4141
Second, such relative paths are a building block to enable portable virtual
4242
environments, i.e. copying a virtual environment as-is between hosts of
43-
compatible platforms. Portable virtual environments are appealing because virtual environments
44-
are a popular mechanism for running Python applications. This provides several
43+
compatible platforms. For example, by pointing to a parent directory, the
44+
virtual environment becomes independent of path prefix differences between
45+
hosts (e.g. ``/usr/local/`` in a container vs
46+
``/home/user/.pyenv/versions/3.12.0/bin`` in a user's dev environment).
47+
48+
Portable virtual environments are appealing because virtual environments are a
49+
popular mechanism for running Python applications. This provides several
4550
benefits:
4651

4752
* The closer the development environment is to the non-development environment,
48-
the more reliable software can be achieved, and the easier it is to reproduce
49-
issues
50-
* The simpler the process of re-creating the environment, the more reliable
51-
software can be achieved, and the faster the process can be.
53+
environment-specific issues are less likely, and the easier it is to
54+
reproduce issues.
55+
* The simpler the process of re-creating the environment, environment-specific
56+
issues are less likely, and the faster the process can be.
5257

5358
Making it simpler to copy a virtual environment from one host to another
5459
mitigates these categories of problems. Additionally, the development tools to
@@ -157,10 +162,10 @@ accordingly.
157162
How to Teach This
158163
=================
159164

160-
Teaching this should be straightforward: if you use a relative path in ``pyvenv.cfg``,
161-
then it's relative to the directory containing the ``pyvenv.cfg`` file. This
162-
is simple to explain and easy to understand for anyone that is already familiar
163-
with handling relative filesystem paths.
165+
Teaching this should be straightforward: if you use a relative path in
166+
``pyvenv.cfg``, then it's relative to the directory containing the
167+
``pyvenv.cfg`` file. This is simple to explain and easy to understand for
168+
anyone that is already familiar with handling relative filesystem paths.
164169

165170

166171
Reference Implementation
@@ -189,8 +194,9 @@ References
189194
* `rules_py <https://github.com/aspect-build/rules_py>`__: implements
190195
host-relocatable virtual environments.
191196
* `python-build-standalone <https://github.com/astral-sh/python-build-standalone>`__
192-
* `venvstacks <https://pypi.org/project/venvstacks/>`__: a tool for creating reproducible distribution artifacts from virtual environments
193-
A relocatable Python runtime.
197+
* `venvstacks <https://pypi.org/project/venvstacks/>`__: a tool for creating
198+
reproducible distribution artifacts from virtual environments A relocatable
199+
Python runtime.
194200
* `PoC for relative home in Python startup <https://github.com/python/cpython/compare/main...rickeylev:cpython:feat.relative.pyvenv.home>`__
195201
* `Python Ideas "Making venvs relocatable friendly" discussion <https://discuss.python.org/t/making-venvs-relocatable-friendly/96177>`__
196202
* `gh-136051: relative pyvenv.cfg home <https://github.com/python/cpython/issues/136051>`__

0 commit comments

Comments
 (0)