From cadec98330fcbb413d8c6a71a562dbac36562e8b Mon Sep 17 00:00:00 2001 From: Sebastiaan Huber Date: Mon, 3 May 2021 19:23:27 +0200 Subject: [PATCH] CLI: use custom `PathOrUrl` for `aiida-pseudo install family` (#80) Instead of using the `PathOrUrl` parameter type from `aiida-core` we add our own implementation that uses the `requests` library instead of `urllib`, but most importantly, it attempts to retrieve the URL in the `attempt` context manager that will catch any exceptions and properly display the error and exit the command, just like other important parts of the command that can fail. In addition, the `PseudoPotentialFamilyParamType` is updated to take an `exclude` list at construction time to signify a list of values that are considered to be invalid. We use this in the `install family` command to blacklist the `pseudo.family.sssp` and `pseudo.family.pseudo_dojo` since they have their own dedicated install commands that should be used instead. Finally, the `-F/--archive-format` option is changed to use `-f` for the shorthand instead, such that it allows `-F` for the `--family-type` which makes more sense there given that we have `-P/--pseudo-type`. The option was only in use by `install family` which was a broken command currently anyway, so the breaking change shouldn't affect any users. --- README.md | 12 ++-- aiida_pseudo/cli/install.py | 102 ++++++++++++++++------------- aiida_pseudo/cli/params/options.py | 4 +- aiida_pseudo/cli/params/types.py | 40 +++++++++++ tests/cli/test_list.py | 8 +-- 5 files changed, 107 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 325786a..33c303a 100644 --- a/README.md +++ b/README.md @@ -154,18 +154,16 @@ aiida-pseudo install family