Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[venv] record which executable and command were used to create a virtual environment #85183

Closed
brettcannon opened this issue Jun 17, 2020 · 3 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@brettcannon
Copy link
Member

BPO 41011
Nosy @brettcannon, @vsajip, @akulakov
PRs
  • bpo-41011: venv -- add more variables to pyvenv.cfg (GH-30382) #30382
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2020-06-17.21:25:37.992>
    labels = ['type-feature', 'library', '3.11']
    title = '[venv] record which executable and command were used to create a virtual environment'
    updated_at = <Date 2022-01-07.06:51:02.290>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2022-01-07.06:51:02.290>
    actor = 'vinay.sajip'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2020-06-17.21:25:37.992>
    creator = 'brett.cannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41011
    keywords = ['patch']
    message_count = 2.0
    messages = ['371775', '409949']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'vinay.sajip', 'andrei.avk']
    pr_nums = ['30382']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue41011'
    versions = ['Python 3.11']

    @brettcannon
    Copy link
    Member Author

    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.

    @brettcannon brettcannon added 3.10 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 17, 2020
    @merwok merwok added 3.11 only security fixes and removed 3.10 only security fixes labels Jan 4, 2022
    @vsajip
    Copy link
    Member

    vsajip commented Jan 7, 2022

    New changeset f4e325c by andrei kulakov in branch 'main':
    bpo-41011: venv -- add more variables to pyvenv.cfg (GH-30382)
    f4e325c

    @furkanonder
    Copy link
    Sponsor Contributor

    @brettcannon The issue seems to be solved. We can close the issue.

    @vsajip vsajip closed this as completed May 10, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants