Skip to content

Commit 86ce0db

Browse files
committed
PEP 838: Add python-version to pyvenv.cfg
Stacked on top of #2201.
1 parent 53e37b7 commit 86ce0db

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎source/specifications/virtual-environments.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ are defined:
4444
also add the system site directories to ``sys.path`` after the virtual
4545
environment site directories. If ``false``, the system site directories are
4646
not included. Defaults to ``true``.
47+
* ``python-version``: Contains a string value with the major and minor version
48+
of the Python interpreter, such as ``3.16``. The value can be obtained with
49+
``f"{sys.version_info[0]}.{sys.version_info[1]}"``. It omits the patch
50+
version or any other version components. Tools MUST write ``python-version``
51+
to ``pyvenv.cfg`` when creating the virtual environment.
4752

4853

4954
Declaring installation environments as Python virtual environments
@@ -63,3 +68,4 @@ History
6368
- May 2012: This specification was approved through :pep:`405`.
6469
- Nov 2026: Removed PEP 405 references and clarified that
6570
``include-system-site-packages`` defaults to ``true``.
71+
- Nov 2026: Added ``python-version`` from :pep:`838`.

0 commit comments

Comments
 (0)