Skip to content

Commit f3961eb

Browse files
Update index.rst, compatibility section added, other subheadings created (#2897)
Signed-off-by: Bernát Gábor <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 75518b1 commit f3961eb

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

docs/index.rst

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ virtualenv
3030
:target: https://pypistats.org/packages/virtualenv
3131
:alt: Package popularity
3232

33-
``virtualenv`` is a tool to create isolated Python environments. Since Python ``3.3``, a subset of it has been
33+
``virtualenv`` is a tool to create isolated Python environments.
34+
35+
virtualenv vs venv
36+
------------------
37+
38+
Since Python ``3.3``, a subset of it has been
3439
integrated into the standard library under the `venv module <https://docs.python.org/3/library/venv.html>`_. The
3540
``venv`` module does not offer all features of this library, to name just a few more prominent:
3641

@@ -40,6 +45,9 @@ integrated into the standard library under the `venv module <https://docs.python
4045
- is not upgrade-able via `pip <https://pip.pypa.io/en/stable/installing/>`_,
4146
- does not have as rich programmatic API (describe virtual environments without creating them).
4247

48+
Concept and purpose of virtualenv
49+
---------------------------------
50+
4351
The basic problem being addressed is one of dependencies and versions, and indirectly permissions.
4452
Imagine you have an application that needs version ``1`` of ``LibFoo``, but another application requires version
4553
``2``. How can you use both these libraries? If you install everything into your host python (e.g. ``python3.8``)
@@ -53,6 +61,31 @@ In all these cases, ``virtualenv`` can help you. It creates an environment that
5361
that doesn't share libraries with other virtualenv environments (and optionally doesn't access the globally installed
5462
libraries either).
5563

64+
65+
Compatibility
66+
-------------
67+
68+
With the release of virtualenv 20.22, April 2023, (`release note <https://virtualenv.pypa.io/en/latest/changelog.html#v20-22-0-2023-04-19>`__) target interpreters are now limited to Python v. 3.7+.
69+
70+
Trying to use an earlier version will normally result in the target interpreter raising a syntax error. This virtualenv tool will then print some details about the exception and abort, ie no explicit warning about trying to use an outdated/incompatible version. It may look like this:
71+
72+
.. code-block:: console
73+
74+
$ virtualenv --discovery pyenv -p python3.6 foo
75+
RuntimeError: failed to query /home/velle/.pyenv/versions/3.6.15/bin/python3.6 with code 1 err: ' File "/home/velle/.virtualenvs/toxrunner/lib/python3.12/site-packages/virtualenv/discovery/py_info.py", line 7
76+
from __future__ import annotations
77+
^
78+
SyntaxError: future feature annotations is not defined
79+
80+
81+
In tox, even if the interpreter is installed and available, the message is (somewhat misleading):
82+
83+
.. code-block:: console
84+
85+
py36: skipped because could not find python interpreter with spec(s): py36
86+
87+
88+
5689
Useful links
5790
------------
5891

0 commit comments

Comments
 (0)