-
Notifications
You must be signed in to change notification settings - Fork 227
verdi code setup --config
ignores the yaml file
#5929
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
Comments
verdi code setup --config
brokenverdi code setup --config
ignores the yaml file
I think Not sure what we can do here. Since the deprecation was really recent, I don't think we will be able to remove it anytime soon. |
Was the analysis correct @ConradJohnston or is there another problem you think? |
Hi @sphuber, I played with it a little bit more. I think you're right - it's selective in its hearing. |
The parsing of the config file is done by the It seems the author looked into this, but the design of Some other guy responded though that his library There is a lot more functionality than we need (or even want, a lot of it is way too opinionated and we definitely don't want to adopt) but it seems possible to just use the config parsing component. |
@sphuber If nothing else, I see indeed that there is a |
I tried the I made some progress using it as a drop in replacement. It unfortunately seems to use a hard-coded set of types to check against and so chokes on the various custom types implemented in AiiDA. |
What I like about click-config-file is that it is 165 lines of code, with After adding some initial feature adds, the dependency has been "set and forget". click-extra is quite a different beast in this respect https://github.com/kdeldycke/click-extra/blob/5759c140a8636e8e49281940ecde1fcb78323963/pyproject.toml#L70 I'm not saying that we should not switch to click-extra, just mentioning this as something to keep in mind. |
I fully agree, it is adding a lot more complexity and potentially other breakages and headaches. We should really weigh the benefits/costs here and maybe conclude that we leave this as is, unless we can include it is |
@ltalirz and @sphuber - we're going around the houses a little. What I'm thinking is that perhaps the config file is handled in a manual way by an additional sub-subcommand, that exploits all of the options being available in a non-interactive way. Something like a |
I had a quick look at the code and couldn't really see why it wouldn't be possible to add the check we need. I made a quick mock-up in #5939 . At least for the following test example it works just fine. Take the following test command: #!/usr/bin/env python
import click
from aiida.cmdline.params import options
@click.command('test')
@click.option('-a')
@click.option('-b')
@options.CONFIG_FILE()
def test_command(a, b):
print(a, b)
if __name__ == '__main__':
test_command() and then call it with ./cli.py --config config.yml where
And the result is
I haven't tested this with any existing Only downside is that the fix requires me to override |
Reading phha/click_config_file#11 again, I realise now that a particular edge case is being discussed, and the author wanted a complete solution, whereas we can make do. I tried your branch @sphuber - delicious. Works well for my test cases so far. |
Preface: I know
code setup
is deprecated in favor ofcode create
, but we should still document this bug for travelers from search engines.Version: v2.2.1.post0
Expectation:
verdi code setup --config foo.yml
should read the contents of the yaml file and setup up the code without prompting the user.Current situation:
verdi code setup
ignores the config file.verdi code create
does the correct thing.Proposed solution:
verdi code create
does work andcode setup
is deprecated, so don't fix and removecode setup
as soon as sufficient notice of deprecation has passed.The text was updated successfully, but these errors were encountered: