-
-
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 an option to skip install commands #394
Comments
Sounds good to me. Seems like we should add the |
I'm interested in seeing if I can figure this out 🙂 |
I added what seemed like the right options change in the branch at https://github.com/PlayTechnique/nox/tree/394-add-no-install-flag I started getting test failures in
I inspected the options in the
However, for the install_only options this I do also see that the help doc string for the options has this tantalising tidbit:
Do I maybe need to register the 'no_install_only' in this namespace object somehow? |
Aha! I see! I updated the noxfile to add some additional arguments to pytest
I then ran the nox command from CONTRIBUTING.md and got a couple of additional clues. First, the native stacktrace:
Then I tried inspecting the namespace object to see what attributes are there. The Namespace docs seemed to say that the
I could see that my |
Next, I just need to work out how to execute nox from inside its directory, so I can verify the option's presented in the help etc and that it's doing something. |
Oh! I think I misunderstood the original request! It's not just for a negation of |
Some pointers for @jamandbees or anybody interested in tackling this:
You can take a look at the analogous code for HTH :) |
That's awesome, thanks @cjolowicz! |
* skips pip installs * skips conda installs
* skips pip installs * skips conda installs
I have something that covers the I wanted to double check that
I'm assuming you're right and that the This is what I had come up with:
Could I get a little extra assistance on this? Thanks 🙂 |
Actually, I'll just implement it like above and create the pull request and we can move this into a PR review. That might work be easier for you folks instead of offering patches in comments 🙂 |
* skips pip installs * skips conda installs * skips run_always if no-install is set
…ntrblm#394) * skips pip installs * skips conda installs * skips run_always if no-install is set
Here's the PR I said I'd pop up #405 |
What do you think about adding a shortcut option for |
Thank you @jamandbees for submitting your PR! I have some questions about how Maybe @theacodes or the other maintainers would like to chime in here as well. 1. The first question is about what @emilmelnikov just remarked:
It seems to me that 2. The second question is about what we should do if an environment does not exist yet. If the environment was just created from scratch, skipping the installation steps would, again, lead to errors later on. There are some options here:
Personally, I think I prefer the second behavior, as the user probably just wants to speed up repeated runs. Also, this behavior is more in the spirit of The first behavior could make sense if there's some specific other reason against running install commands, like avoiding network access. I'm not sure how relevant this use case is. The first behavior is also more in line with what it says on the tin: 3. My third question is about whether The name However, I would argue that Here are two important use cases for
These are clearly part of the installation phase of the session. Currently, the only purpose of Personally, I have a use case where the session builds a wheel, uninstalls it from the environment using (You can tell from what I'm saying above that I'm not a huge fan of the name |
When the new hypothetical |
Hey folks - I just want to be sure to let you know that, whatever the outcome of this chat, I'll be happy to implement the changes. I appreciate the time you're putting in to make this better 🙂 |
Thanks @jamandbees, actually the points above don't require many changes. How about if we proceed to iterate on your PR? You already implemented point 3 (skipping Point 1 (implying Point 2 (ignoring
As for the option name, let's wait for feedback/additional ideas. Maybe a short option |
Sounds good! I'll take a look today |
…trblm#394) reuse_existing is now true if we are not installing pacakges.
_clean_location already detects whether a venv is being reused or not, so setting the boolean within this is safe. whether a venv exists or not.
Here's a different proposal:
@jamandbees Would you be okay with doing this change? Specifically, in We also may want to revisit when and how warnings are printed. Currently there is a warning every time an installation happens despite |
@cjolowicz I'm super happy to implement whatever changes you folks decide upon! I'm just stoked you all are hanging out and giving me direction 🙂 Would you like me to implement the above suggestion on a different branch, so you can see how it looks? |
@jamandbees You're welcome :) Thanks for implementing it!
You can just continue on the existing PR. It also makes it easier for us to keep track of things 😉 |
If this will be implemented, then I would like to ask for a shortcut option that combines |
How does I’ve been trying to work on nox over the weekend but I got my covid vaccine last week and was pretty wiped out for a few days. I’m hoping to knock this out this week 🙂 |
I've implemented the request; I've decreased test coverage, though, and am just trying to figure that out. |
…#394) Also reduces log verbosity by only noting package reinstallation when venv is not explicitly reused.
I've been poking at this test coverage issue on and off all day and made no headway. It seems to me like the coverage tool is saying that lines which are explicitly verified are not being tested. The coverage report shows I went ahead and pushed the change; is there any chance you could take a look when you have a minute @cjolowicz and see if you can see something I don't? 🙏 Beyond that, I could see how to add a new option that implies both
However, I want to implement that by flipping |
Oh! I have an idea for that second problem! Lemme work it out 🙂 |
Removes unneeded logger messages when --no-install is ignored. Simplifies tests and restores 100% test coverage.
Hey gang - I'm still on this, I'm just also busy with some other stuff that will hopefully mellow out in the next week. Just to write this down, my idea for working on the option requested above is that I don't think there's currently a way to specify an option on the command line which only has the side-effect of setting other options to a known state, so I was thinking of implementing a new option type that allowed for that behaviour. I had read over the _option_sets.py code and the _options.py code; I'm pretty sure I can implement a new option type, but if you can think of a simpler solution then I'd be happy to hear it 🙂 |
Again, sorry for dropping this for a bit! I was studying/interviewing for jobs, but I'm all done with that now. I'm looking forwards to finishing this up. |
…ntrblm#394) * skips pip installs * skips conda installs * skips run_always if no-install is set
…trblm#394) reuse_existing is now true if we are not installing pacakges.
This boolean informs us whether we need to ignore the "no-install" command line option.
Extracted and renamed SessionNoSlots to MockableSession to clarify what it is used for. Reduced duplication of that code. Duplicated several tests for conda installs but ensured that the no-install flag was set and ignored.
This was good advice from @cjolowicz helping to clarify the intention of this boolean.
_clean_location already detects whether a venv is being reused or not, so setting the boolean within this is safe. whether a venv exists or not.
…#394) Also reduces log verbosity by only noting package reinstallation when venv is not explicitly reused.
Removes unneeded logger messages when --no-install is ignored. Simplifies tests and restores 100% test coverage.
Also reduces verbosity of run_always logging for no_install.
Also removes logging for no_install.
@emilmelnikov @purefunctor This is being addressed in #432, feel free to comment. |
How would this feature be useful?
Frequently you just want to re-run a particular session in a reused virtual environment as quickly as possible (e.g for unit tests, docs or linting). This is possible with
--reuse-existing-virtualenvs
, butsession.install()
still takes a second or two, which is not a lot, but still slower than just runningpytest
directly. Therefore, it would be useful to have an option for skippingsession.install()
, especially when executing sessions locally in a development loop.Describe the solution you'd like
Add an inverse of the
--install-only
command.Describe alternatives you've considered
.nox/<session_name>/bin/python -m pytest
.The text was updated successfully, but these errors were encountered: