Automatically set correct renderer for Plotly charts in VSCode Notebooks
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
Because https://github.com/microsoft/vscode-notebook-renderers/pull/199 is unmerged, users of Plotly.py using the VSCode notebooks cannot access the latest Plotly.js/Plotly.py features and no discernible error message is provided. This leads to confusion, because users are working with the latest version of Plotly.py and their charts don't work properly.
This has caused issues for adoption of new features like MapLibre and subtitles in charts, and may others. See e.g.:
- https://github.com/plotly/plotly.py/issues/4715
- https://github.com/plotly/plotly.py/issues/4775
- https://github.com/plotly/plotly.py/issues/4701
- https://github.com/plotly/plotly.py/issues/4583
- https://github.com/plotly/plotly.py/issues/4560
- https://github.com/plotly/plotly.py/issues/4475
- https://github.com/plotly/plotly.py/issues/4528
- https://github.com/plotly/plotly.py/issues/4264
- https://github.com/plotly/plotly.py/issues/4173
- https://github.com/plotly/plotly.py/issues/4094
Developers can workaround this by adding to their notebook:
import plotly.io as pio
pio.renderers.default = "notebook_connected"
While this is trivial to change, it's undiscoverable and non-intuitive. If you have the latest version of Plotly.py installed, you should be able to use the latest features in any Python environment!
Regardless of whether https://github.com/microsoft/vscode-notebook-renderers/pull/199 is merged, this dependency means VSCode Notebook users will always lag behind Plotly.py releases as we wait for VSCode to adopt and release their own updates, which means VSCode users would never have day-of updates without a workaround 🙁
Is it possible to detect that we're in a VSCode Notebook environment and automatically set the correct renderer to avoid this dependency on a VSCode update?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository files or tests are named. Start by reading the renderer configuration exposed through plotly.io, especially the pio.renderers.default entry point, and investigate how notebook environments are identified. Done means VSCode Notebook users automatically receive the current compatible renderer without adding the documented workaround, with coverage for the detection behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jupyter-notebook, python
- Domain
- data-visualization, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100