Provide an environment variable to automatically create or require a virtual environment #243
brettcannon
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Like how Hatch creates an environment automatically, having a way to signal to the Launcher that an environment should always be used by a project might be helpful.
The way I currently see it in my head is:
PY_CREATE_VIRTUALENV
) that when set means the Launcher will create a virtual environment if one isn't found.PY_CREATE_VIRTUALENV
is anything but the empty string or1
, it's used as the command to pass to the selected Python interpreter to create the virtual environment (not sure if string substitution like{version}
when a version is specified/found would be useful).pyproject.toml
is found in the current or parent folders to act as an anchor point for the workspace.I'm not sure if automatic installation into that environment makes sense.
It might also make more sense to not have this built in but instead to have a
py pip
subcommand (see #222 ) which will do the creation as necessary. Insteadpy
could have aPY_REQUIRE_VIRTUALENV
instead which will refuse to run if apyproject.toml
is found but no virtual environment (similar to whatPIP_REQUIRE_VIRTUALENV
does).Beta Was this translation helpful? Give feedback.
All reactions