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
Confusing behavior of hv.extension() #2132
Comments
I agree that's confusing. PR? |
I made a branch to fix the obvious warning message error, but unfortunately the function confused me more than the error message, so I stopped there. I don't understand the intent...maybe it has changed over time? |
But when I squint at the code in there, it seems to be about plotting only, maybe? |
If someone confirms the docstring is right, or supplies an updated docstring, I'll make a PR for the function itself... |
Yes, it has definitely evolved over time, changing names once or twice and changing how it works. Long ago, it was called notebook_extension(), and it was only for installing ipython-notebook support. When we added multiple plotting backends (now more accurately considered frontends), we decided that we should just have one extension loading mechanism, and shortened the name. So the intent is for it to cover any extensions, even though currently what it handles is bokeh, matplotlib, plotly, and ipython (I think?). |
To me it seems like it only handles plotting (judging from it defaulting to loading matplotlib, and attempting to import
|
Right, but there's another level beyond that, due to some monkeypatching in
That way user code is the same whether in or out of the notebook environment, but it does make this code horrible to reason about, and it also makes error detection very awkward. |
To me it seems like this code could be inverted to have one, normal function "extension()" with no monkeypatching, just a try/except import that runs some code in the try, and then runs other stuff in the except. |
The problem is that holoviews/holoviews/ipython/__init__.py Lines 102 to 106 in 04ba54a
@jlstevens do you have any objections in making Jedi completion true by default? |
No objections as long as:
I'm happy to defer to your judgement on this but I do remember jedi completion did not work as expected and broke a lot of tab-completion suggestions we had put effort into generating. That was a long time ago though and it is entirely possible that now it is fixed and works well. |
Thanks for this useful trick and the background information. I actually swapped into using jupyterlab because there tab auto-completion worked well. However, after now going back to check in ordinary jupyter notebook it magically seems to work there too with no further modifications. I notice however, that when starting jupyter notebook from command line using 'jupyter notebook' that the terminal is reporting 'Loading JupyterLab as a classic notebook (v6) extension.' so I wonder if somehow using the jupyterlab in classic notebook mode (as opposed to using jupyter with no jupyterlab available) is making a difference. |
The way jedi sorts its completions does still annoy me and multi-level completions used the work fine without jedi but this looks it is no longer the case. Given this situation, I think we should allow jedi to be on by default despite my distaste for it. |
(in an env with matplotlib)
(in an env without matplotlib)
The text was updated successfully, but these errors were encountered: