-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Auto determine and configure the environment #2242
Comments
I've asked the VS-Code Python developers if there is a way to determine if I am running inside VS Code Interactive Notebook. |
We have asked Jupyter again and again whether there is some way to determine the frontend and the answer each time was that the backend should stay completely agnostic as to the frontend and therefore no support for identifying the environment would ever be provided. So while I agree this would be nice I'm strongly inclined to close this issue since it is out of our hands and anything we do implement will be hacky and/or very brittle. |
What if we provided |
Thanks @philippjfr . I feel your frustration. If ever they (Jupyter, VS Code, Colab etc) should provide something. What should it be? An imported module? |
The goal is not to need to specify |
That supposes we have a mechanism (hacky or not) to detect the frontend, which we don't.
Panel itself (and Bokeh) is the extension that has to be loaded in the notebook, so there's no way around it and since running the extension on the server isn't harmful it should generally be included. |
Using the same code is already possible between server and notebook contexts; In any case, the code to install the javascript that's required in some environments has to be invoked somehow, and so if not through a call to So such a request comes down to (1) accepting that invoking the auto-detection would still need to be done explicitly, and (2) actually implementing the autodetection. If you're ok with (1), seems like it would be ok to try to achieve (2), though it is not at all straightforward (by design of Jupyter). |
To be clear |
Good point; I was confusing about that. But here we are not talking about deck/echart/vega/mathjax support, but about environments: vscode, collab, jupyter, jupyterlab, bokeh server, voila. |
For VS Code running locally on a laptop Would you accept a PR that sets |
We already auto-determine colab here: https://github.com/holoviz/panel/blob/master/panel/config.py#L556 |
Sounds like the docs need updating? |
I'm pretty sure that I wrote that and then Philipp made it obsolete. PRs to update the docs strongly encouraged! |
I think we now auto-detect all common environments and docs have been updated. |
If you go to https://github.com/holoviz/panel you can see that Panel can be used in many different environments: Notebook, Lab, VS Code, Colab, Panel Server, Voila Server etc.
I am switching back and forth between most of these. Especially Jupyter Labs, Notebook running in VS Code, Panel Server and now potentially Voila Server. C.f. #2241
Right now I have to add/ remove
pn.extension(comms='vscode')
,pn.extension(comms='colab')
,pn.extension(comms='ipywidgets')
depending on the environment.It is not efficient that I have to change/ update the code depending on the development or deployment environment. Furthermore it can confuse new users and lead to support questions on how to use Panel in XYZ environment. Or just users leaving because they don't think it works in their favorite environment. Furthermore it makes it complicated to develop example notebooks for a community of users with different preferences for using those example notebooks. For example for Panel or for work.
Solution
Find a way to auto detect the environment and automatically do the configuration.
The text was updated successfully, but these errors were encountered: