-
-
Notifications
You must be signed in to change notification settings - Fork 167
Description
How would this feature be useful?
nox
supports --no-install
and -R
options for not running installation commands, usually for use when reusing existing environments, and to speed up development where the install process is often the long pole.
But there doesn't seem to be a good way to indicate when something run via session.run
is an install command -- specifically, if you're installing something not via pip
or conda
etc, which you may want to skip in the same scenarios as the above.
Concretely -- given a Javascript project, one might run (p)npm install
to install all the project dependencies, followed by some test runner, e.g. jest
, all under a noxenv called ui-tests
.
In this scenario it would be nice if nox -s ui-tests -R
was able to not run the install command, but the existing -R
of course has no way to know which command to skip.
Even doing this externally (in the noxfile) seems nontrivial, as it seems the way session.install
does this is by accessing private internals, e.g.:
Lines 629 to 630 in 5c82dc5
if self._runner.global_config.no_install and venv._reused: | |
return None |
Describe the solution you'd like
Add a session.run_install(...)
command which runs a subprocess but assumes that subprocess is an installation command which will be skipped when using -R
/ --no-install
.
Refactoring session.install
and session.conda_install
to call this to do their no_install
check seems also like a nice minor internal refactor.
Describe alternatives you've considered
I personally don't like boolean flags (as a rule), but session.run(..., is_install=True)
is an alternative for those who are less averse.
A further alternative is to make more things public API (e.g. whether no_install is active) so that someone can do this themselves in their noxfile, but given that nox
itself has 2 places where it itself wants this, it seems like something generally useful to me.
Anything else?
A concrete noxfile
where I wanted this functionality is here.