-
Notifications
You must be signed in to change notification settings - Fork 191
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
CLI: verdi plugin list
fails for data plugins
#6557
Comments
Thanks for the analysis @t-reents . Coincidentally, I had just responded to @edan-bainglass comment on the related PR. I will copy the comment here:
As to your suggestion:
This would be vulnerable still, because it requires constructing the class and that might require arguments. An example would be a What we really need to have is something that would work for all "plugins". And plugins here really can be any class, or even function really. So I think our best bet would be to use the docstring. It is guaranteed to exist and at worst returns |
Ah, I missed that Edan has already commented, I thought he stopped after our discussion :D sorry for the kind of duplicated issue True, the The doc-string approach makes sense! |
Thanks @t-reents and @edan-bainglass for finding this issue. So for backward compatibility, I would keep the |
@edan-bainglass encountered the following issue and I've quickly investigated it.
Running e.g.
verdi plugin list aiida.data core.array
causes an exception:This error was introduced in #6411. In previous versions, e.g.
aiida-core 2.5
, the command would simply print the error:Error: No description available for core.array
Due to the changes in the aforementioned PR #6411, the
try except
is not triggered. As noAttributeError
is raised anymore after adding thehasattr(plugin, 'is_process_function')
:aiida-core/src/aiida/cmdline/commands/cmd_plugin.py
Lines 50 to 58 in fb36862
Since the
hasattr
simply returnsFalse
in case of theArrayData
, theelse
statement is executed. Here, the error shown above is raised, asplugin.get_description()
tries to callget_description
on the class and not on an object. However,get_description
is not a class method inorm.Node
, leading to the exception.Without thinking too much about it, one possible fix would be to create an object, i.e. calling
plugin().get_description()
(this would work for methods and class methods). However, I'm not sure if this will cause additional problems.Furthermore, one could catch the
TypeError
in theexcept
statement as well. Again, these were just some ideas that came to my mind. There might be more things to consider that could lead to different solutions.Pinging @sphuber and @khsrali who have worked on the previous PR.
The text was updated successfully, but these errors were encountered: