Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've started #848. This allows you to write a noxfile like this:
Any dependencies, including version ranges and nox, will be checked. If not satisfied, nox will make a new
.nox/_nox_script_mode
environment, set it up with the above dependencies, and then pass control to the new nox environment. Requires-python is not respected yet, might need #814. That can be added later, not a target for this PR.I've allowed this to be passed via flag and envvar, but envvar always comes first, and overrides the flag. This ensures the second run will never trigger a third run of nox. If someone has other ideas for ways to ensure this, I'm open. Also, the envvar is needed if you request an older nox, since the flag won't be valid in the "inner" run.
--script-mode=fresh
allows you to enforce a fresh environment.It supports both pip and uv; since this is a new feature, defaulted to uv if available, and fallback on pip. Maybe should be configurable; currently it's locked on the "default" is
uv|virtualenv
.It's a bit less clever on Windows following pipx's example; pipx doesn't use process replacement there; the original PR said it "wasn't reliable" for pipx. Looks like path quoting is not handled by this method, and it doesn't do anything special on Windows. pypa/pipx#531
Note this is available in tox as
requires = ...
, but before PEP 723 there wasn't a clean way to do this for nox.Fix #414.