This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [venv] record which executable and command were used to create a virtual environment
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: andrei.avk, brett.cannon, vinay.sajip
Priority: normal Keywords: patch

Created on 2020-06-17 21:25 by brett.cannon, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 30382 merged andrei.avk, 2022-01-04 02:06
Messages (2)
msg371775 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-06-17 21:25
When a virtual environment is created, the resulting pyvenv.cfg specifies the directory which contained the Python executable and the version of Python (see https://github.com/python/cpython/blob/master/Lib/venv/__init__.py#L147). Unfortunately that may not be enough to work backwards to which binary was used to create the virtual environment.

My idea is to add an `executable` and `command` key to pyvenv.cfg which record the Python executable name and the command used to construct the virtual environment, respectively. The former would disambiguate which exact Python interpreter was used, and the `command` key could be used by e.g. virtualenv to record what was used to construct the virtual environment. That potentially could be used to make recreating a broken virtual environment easier.
msg409949 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2022-01-07 06:51
New changeset f4e325c21d6d9c2bf70224dc69d707b226f87872 by andrei kulakov in branch 'main':
bpo-41011: venv -- add more variables to pyvenv.cfg (GH-30382)
https://github.com/python/cpython/commit/f4e325c21d6d9c2bf70224dc69d707b226f87872
History
Date User Action Args
2022-04-11 14:59:32adminsetgithub: 85183
2022-01-07 06:51:02vinay.sajipsetmessages: + msg409949
2022-01-04 17:30:43eric.araujosetversions: + Python 3.11, - Python 3.10
2022-01-04 02:06:48andrei.avksetkeywords: + patch
nosy: + andrei.avk

pull_requests: + pull_request28592
stage: patch review
2020-06-17 21:25:38brett.cannoncreate