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

Support Specifying Usage of an Existing Venv #759

Open
AgentK9 opened this issue Feb 1, 2024 · 1 comment
Open

Support Specifying Usage of an Existing Venv #759

AgentK9 opened this issue Feb 1, 2024 · 1 comment

Comments

@AgentK9
Copy link

AgentK9 commented Feb 1, 2024

How would this feature be useful?

Enabling Nox's session class to utilize an existing virtual environment (venv) instead of creating a new one each session would decrease setup times significantly. Distributing a pre-generated venv with projects, Docker images, or virtual machines offers notable time savings for short-lived jobs and enhances scalability in a cost-effective manner.

Describe the solution you'd like

A practical solution would be to introduce a new Nox command that either creates an empty venv or selects a pre-existing one at a given location. Enhancements to consider include:
a) Enabling the pre-installation of specific packages.
b) Allowing Nox to identify the target venv through an environment variable, command-line option, or argument.

Describe alternatives you've considered

While it's possible to bypass nox's backend by manually specifying pip installations in the noxfile, this approach leads to less clean configurations and potential conflicts with system-installed packages. An alternative method involves directing nox to use a different directory for venvs, yet this does not address the need for a singular, pre-configured venv.

I have to modify my noxfile to explicitly use session.run('pip', 'install', ... instead of session.install, which makes for messier noxfiles.

Anything else?

This request is in the context of using nox (install through pipx) is being executed inside Docker containers running on a GitLab CI/CD platform.

@AgentK9 AgentK9 changed the title Add an option to the python session method to specify a venv to use Support Specifying Usage of an Existing Venv Feb 1, 2024
@cjolowicz
Copy link
Collaborator

Have you considered using the -r or -R flags to reuse the prepopulated environments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants