Skip to content

Nested virtual environment support in site/venv modules #129445

Open
@dmatech1

Description

@dmatech1

Feature or enhancement

Proposal:

It's a bit of a niche use case, but it would be helpful if you could have one virtual environment be created that references another as its parent. If you currently attempt to do this, the pyvenv.cfg of the child virtual environment only indirectly references the parent through the command variable (which doesn't appear to be used). The code in site.venv could be enhanced to infer the prefix of the parent environment and add those site packages after the current virtual environment. This would ensure that the order of sys.path entries would be appropriate.

This would allow you to create a group virtual environment with a lot of common packages and still allow users to have their own child environments with additional or newer packages.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-venvRelated to the venv moduletype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions