-
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
Tab completion inside a shell #978
Comments
I can reproduce this using the same steps. |
The reason seems to be the following:
so once The Ipython completer however tries to import modules (using If the IPython completer was using importlib.import_module, it probably would not get confused, as In[1]: import_module('aiida.orm.calculation')
Out[1]: <module 'aiida.orm.calculation' from '/home/hauselmann/Documents/aiida-fork/aiida/orm/calculation/__init__.pyc'>
In [2]: import_module('aiida.orm')
Out[2]: <module 'aiida.orm.implementation.calculation' from '/home/hauselmann/Documents/aiida-fork/aiida/orm/implementation/calculation.pyc'> However, likely IPython is not using this because it does not exist in older python2 versions. Conclusion: If we want this to work, we need to help out the IPython interpreter to recognize what is going on by avoiding to overwrite submodule names with module members in Suggested solution: instead of importing everything in |
This is exactly the reason why |
Within a verdi shell, the following command is perfectly valid (and works):
from aiida.orm.calculation.inline import InlineCalculation
BUT, if one tries to obtain it using TAB completion, it works only up to
aiida.orm.calculation
and then itdoes not work at all (e.g., typing
aiida.orm.calculation.<TAB>
does not give any list of choices, nor does e.g.aiida.orm.calculation.inl<TAB>
or anything of that kind).Worse: if one then goes manually until reaching the final import and then press TAB there, e.g.:
from aiida.orm.calculation.inline import Inline<TAB>
then everything begins to collapse: first an error is raised
and the shell cannot
<TAB>
complete anything anymore whatsoever (one has to restart it from scratch), i.e. evenimport aii<TAB>
orimport nump<TAB>
will not autocomplete.I presume this is related to the way the two possible backends (django and SQLalchemy) are implemented.
The text was updated successfully, but these errors were encountered: