Skip to content

Add different way to support session.install when venv_backend="none" #1040

@ktbarrett

Description

@ktbarrett

How would this feature be useful?

There are ways around specifically what I'm trying to accomplish, but I figured this was a more general issue.

If I have a session that uses session.install in a session with venv_backend="none" I get the following error:

nox > Session generate_compile_db raised exception ValueError('Session generate_compile_db does not have a virtual environment, so use of session.install() is no longer allowed since it would modify the global Python environment. If you\'re really sure that is what you want to do, use session.run("pip", "install", ...) instead.')

This doesn't work if you are intending to use uv as the backend since the call would need to be uv pip. Then you have an issue where you'd need to know the backend selected by nox to decided which to use, which feels clunky.

Describe the solution you'd like

Instead of asking users to call out pip install explicitly, I think there should be an option to session.install to tell it this situation is fine.

Describe alternatives you've considered

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions