-
Notifications
You must be signed in to change notification settings - Fork 192
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
Dependencies: update to click==8.0
and remove click-completion
#5111
Dependencies: update to click==8.0
and remove click-completion
#5111
Conversation
c20983e
to
370020c
Compare
@chrisjsewell already assigned you before, but @ramirezfranciscof feel free to review this as well if you'd like |
2e1c561
to
37f10be
Compare
37f10be
to
441a300
Compare
441a300
to
32f074d
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.
Thanks for requesting my review. I am a bit confused by the size of this PR. Is it because the branch is not up-to-date?
32f074d
to
a58b344
Compare
Not really. This is just because their were quite a bit of chances in the new click version that required significant changes of our code. I would refer you to the commit messages for more information. I have rebased the branch so it is now up to date. |
d053847
to
d55f6a1
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.
All good from my side. I had only a cursory look over the code, so I'm not going to explicitly approve it, but thanks a lot for making sure that we can move forward with click 8.x. That was quite an effort.
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! @sphuber
I am all good with the changes, only with a bunch of small questions.
I take a detail look at the new interactive.py
implementation. I got a feeling when this PR get merged it is safe to use !
to set the value to None
interactively. Anyway it is not emergent figure out that and will not be a reason to block this PR.
daf3c9d
to
7da17d6
Compare
Thanks for your review @unkcpz . I have addressed your comments and the tests pass. Sole exception is Jenkins, but that seems to be unrelated. Not sure what it is having trouble with |
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.
@sphuber Thanks, looks good to me. Let's get it merged and I'll try it soon.
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.
Don't merge just yet, I want to give it a quick once over today (won't delay it by long)
7da17d6
to
a66b00b
Compare
@chrisjsewell please let me know if I can merge this now |
@pytest.mark.parametrize('non_interactive_editor', ('sleep 1; vim -cwq',), indirect=True) | ||
def test_interactive_remote(clear_database_before_test, aiida_localhost, non_interactive_editor): | ||
@pytest.fixture | ||
def code(aiida_localhost): |
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'd move this centrally to pytest fixtures, as I'm sure it could be of more general use. Not a biggie though
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.
All good cheers, I hope 🤞
ed5f324
to
904aeac
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.
Actually,
https://theossrv6.epfl.ch/jenkins/blue/organizations/jenkins/aiida_core_aiidateam/detail/PR-5111/21/pipeline/56 appears to be hanging at:
aiida-core/.molecule/default/setup_aiida.yml
Lines 59 to 71 in 5530589
- name: verdi computer setup localhost | |
when: aiida_check_computer.rc != 0 | |
command: > | |
{{ venv_bin }}/verdi -p {{ aiida_backend }} computer setup | |
--non-interactive | |
--label "localhost" | |
--description "this computer" | |
--hostname "localhost" | |
--transport core.local | |
--scheduler core.direct | |
--work-dir {{ aiida_path }}/local_work_dir/ | |
--mpirun-command "mpirun -np {tot_num_mpiprocs}" | |
--mpiprocs-per-machine 1 |
Can you have a look into this, as I have a feeling it is something to do with the new CLI interactive setup (perhaps waiting for user input, despite the command setting --non-interactive
)
Yeh this just run through fine in #5201, so I definitely feel it is a "new issue" from this PR |
Getting further, but now hanging on: aiida-core/.molecule/default/test_polish_workchains.yml Lines 22 to 28 in f5053d6
Should |
Yeah, I think it is a problem with defaults not being taken. I was wondering why this then also didn't fail for the GHA, but there the config includes explicit values for those options. Will have a look if it really is the defaults not being taken with |
Oh well, nice to see the Jenkins tests actually being useful and catching a regression lol |
Codecov Report
@@ Coverage Diff @@
## develop #5111 +/- ##
===========================================
- Coverage 81.00% 81.00% -0.00%
===========================================
Files 535 532 -3
Lines 37410 37344 -66
===========================================
- Hits 30301 30247 -54
+ Misses 7109 7097 -12
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
fc87f3a
to
969e36e
Compare
The entire logic around parameter parsing, including the consuming of the value, optionally prompting and then processing the value has changed. Especially the prompting logic has changed, which now makes the custom logic in our `InteractiveOption` largely unnecessary. It had to be refactored significantly and it now no longer changes the prompt behavior but just overrides certain methods to include the concept of non-interactivity which is not native to `click`. In addition to this major change, there were also various smaller changes. The following adaptations had to be made for compatibility: * Parameter validators now have to return the value, whereas before this was not required. * Custom parameter types need to start with checking for the value to already have the expected return type and then return it. This is necessary because the convert method can be called multiple times: https://click.palletsprojects.com/en/8.0.x/parameters/#implementing-custom-types * The `aiida.cmdline.params.options.contextualdefault.ContextualDefaultOption` has been removed as it was not used in `aiida-core` nor in any plugin that is hosted on Github. * `Parameter.get_default` now takes the `call` argument * Remove explicit parameter name from `version_option`, this is now by default set to just `--version`. * Add explicit `type` for `MultipleValueOption` options in `verdi run`. This is necessary because without it the entire string would be parsed as a single string and not a tuple of strings. * The `ConditionalOption` test `test_prompt_callback` had to be changed. With the old `click`, as soon as wrong input was provided at the prompt and the callback raised, the command would fail. With the new behavior of `click`, the user will be prompted until the callback validates, printing the error message each time. This required the test to be changed to actually pass a valid input at the end through the `user_input` or the test would hang as it was infinitely prompting. * The `Path` parameter removed the `path_type` attribute. It has been more or less been replaced by `name`. * The `click._compat.filename_ui` utility was removed. Note that the lower requirement for `click` is set to `v8.0.3` since in lower patch versions the behavior of prompts for boolean type parameters is different.
As of `click==8.0` the full set of functionality that `click-completion` provided for our tab-completion is now shipped with `click` itself, so we can remove this dependency. The main difference is that the string that is required to activate it, is slightly different and it is shell dependent. The documentation has been updated to correctly reflect this. Since it is now shell dependent, the old `verdi completioncommand`, which was already (unofficially) deprecated is no longer correct. To keep it correct, one would have to try and detect the shell but this is clearly outside of the scope of `aiida-core` so we simply remote it.
969e36e
to
0e33cf5
Compare
@chrisjsewell all fixed now |
Just to check, is this now still the behaviour? $ verdi computer setup --non-interactive
Usage: verdi computer setup [OPTIONS]
Error: Missing option '-L' / '--label'. |
yes |
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.
take two
The fix was that the |
Fixes #5098
In this PR, I update the dependency requirement for
click
to the new v8.0 version. Quite a bit was changed and so our cmdline code had to be adapted significantly. Especially the interactive logic was changed allowing our customInteractiveOption
logic to be simplified significantly. After that, in the second commit we can now drop theclick-completion
dependency since all the tab-complete functionality we need are now integrated intoclick
itself. See the two commits for more details on the changes.