-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Add option --no-install to skip install commands in reused environments #432
Conversation
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
Co-authored-by: Jam <[email protected]>
LGTM, thanks! |
@@ -320,6 +327,18 @@ def _session_completer( | |||
group=options.groups["secondary"], | |||
help="Re-use existing virtualenvs instead of recreating them.", | |||
), | |||
_option_set.Option( | |||
"R", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be lowercase, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The option is uppercase (-R
), so using r
as the option name would lead to an error:
Traceback (most recent call last):
File ".../nox/venv/bin/nox", line 33, in <module>
sys.exit(load_entry_point('nox', 'console_scripts', 'nox')())
File ".../nox/nox/__main__.py", line 30, in main
args = _options.options.parse_args()
File ".../nox/nox/_option_set.py", line 267, in parse_args
self._finalize_args(args)
File ".../nox/nox/_option_set.py", line 255, in _finalize_args
value = getattr(args, option.name)
AttributeError: 'Namespace' object has no attribute 'r'
Our option.name
must match the name that argparse derives for the option. In this case, the option is uppercase -R
with no equivalent long option, so argparse derives R
as the option name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha
Add option
--no-install
to skip the re-installation of packages when a virtualenv is reused.Use either of these to reuse a virtualenv without re-installing packages:
The
--no-install
option causes the following session methods to return early:session.install
session.conda_install
session.run_always
This option has no effect if the virtualenv is not being reused.
Closes #394
Supercedes #411
Co-authored-by: @jamandbees