-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Allow bypassing the install only flag #181
Conversation
This seems unnecessary. You can use |
You could also subclass |
You're missing the point. It has nothing to do with posargs. Nox is responsible to install dependencies. |
If you want to know the currently running Python: @nox.session(py=("3.7", ...))
def foo(session):
interpreter = session.virtualenv.interpreter
... You can also scope requirements to specific Python versions with environment markers in a
Sorry for the misunderstanding. I was trying to say you could use |
I'm not creating PRs just because... I know I can get the python version from there, but our goal is to make our users life easier, so, we also have |
@nox.session(py=("2", ...))
def foo(session):
interpreter = session.virtualenv.interpreter
print(interpreter)
...
notice the above lonely |
Yeah this is too far. I don't like the idea of an argument that reverses a flag that itself reverses an argument. It's just Python, you can use |
Your suggestions mean recreating the logic nox has on the noxfile or don't use nox at all(subprocess), that defeats the purpose of having nox to help out setting up the virtualenv... |
I think for now this still just doesn't appeal to my sensibilities. Another alternative is to use session arguments to do what you want: @nox.session
def thing(session):
if "setup-only" in session.posargs:
...
else:
... Or have a shared session like: @nox.session
def setup(sesssion):
...
@nox.session
def thing(session)
setup(session)
... Happy to revisit this later as "no is temporary, but yes is forever" - https://twitter.com/solomonstre/status/715277134978113536?lang=en |
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
To get some information from the system, which we then use to choose the appropriate static requirements file, we need to run some commands, something that nox will refuse to do if `--install-only` is passed. We work around it by manually patching the value of `session._runner.global_config.install_only` for the commands that we MUST run, and only those and then we set it back to the value it had before. For additional information about why we have to do this, please see: wntrblm/nox#181
The reason behind this change is because, for our particular use case, we run some code against the virtualenv python in order to choose what requirements to install.
With this change, we can call nox with
--install-only
which skips all of thesession.run
calls, with the exception of those for which we explicitly passbypass_install_only
.