-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
394 integrates no install flag #411
394 integrates no install flag #411
Conversation
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.
Hi @jamandbees thanks for the new PR 👍
Can you please run nox -s blacken
in your branch? This should take care of the failed lint session in CI.
I left a few more quick comments inline.
394f9c4
to
8262d67
Compare
I didn't make this clear, but linting etc are all passing now. 🙂 |
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.
Thanks, looking nice! Some more comments inline.
4ac9bc1
to
7144b11
Compare
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.
Hey @jamandbees thanks for the update! Here are some suggestions. This should also take care of the coverage woes you mentioned.
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.
Hey @jamandbees here's a fresh review, see the inline comments 👍
I think we're quite close to wrapping this up. The shorthand for -r --no-install
and the documentation can also be left to a follow-up PR. But feel free to have a go at these if you want to.
In case you do want to tackle the shorthand option: I liked the option name you proposed (the second one). Also, a short option -R
would make sense to me (mirroring -r
for plain reuse). You could probably implement this using a finalizer function, see _color_finalizer
in _options.py
for an example.
nox/virtualenv.py
Outdated
@@ -399,6 +402,8 @@ def create(self) -> bool: | |||
self.location_name | |||
) | |||
) | |||
self._reused = False |
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 True not False, because the virtualenv is being reused.
self._reused = False | |
self._reused = True |
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.
(BTW it would be great if the tests would catch this.)
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.
I've added a couple of assertions for _reused, one in the tests/test_virtualenv.py in test_condaenv_create
and the other in test_create
.
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.
I think we're quite close to wrapping this up. The shorthand for -r --no-install and the documentation can also be left to a follow-up PR. But feel free to have a go at these if you want to.
@cjolowicz I think it makes sense to relegate those to a follow-up PR. I think I've had this one hanging out for long enough 🙂
Thanks for your help and patience so far!
…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.
* Updates venv_created to a private data member. * Removes irrelevant interpolation from no-install log messages.
Also removed unnecessary whitespace lines. Co-authored-by: Claudio Jolowicz <[email protected]>
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.
5498014
to
61dbefe
Compare
Also removes logging for no_install.
61dbefe
to
0a088ae
Compare
@jamandbees Thanks for the update! I enabled your CI run, and it looks like some tests need adapting to your latest changes. Could you take a look? |
@cjolowicz I'm honestly not sure how to adapt them; when I check git, I get the impression that this is from a recent merge, but I'm not confident that I understand what's going on. |
Hey @jamandbees , no problem and thanks for your work so far! I picked this up in #432 and credited you as co-author. |
--no-install
. This is used to skip installing packages if the packages have been installed once.venv_created
, which tracks whether or not the virtual environment has already been created. The--no-install
flag behaves differently dependent upon whether a venv is already created or not.no-install
is being ignored and normal installations proceed.--no-install
prevents the installation of packages.SessionNoSlots
into an extracted classMockableSession
. This followed from scratching my head trying to understand what SessionNoSlots provided, and then heading to the PR which implemented it (AddingSession.__slots__
. #128) to see what the class was buying the tests. I'm happy to put this back how I found it 😅Closes #394