Set the 'colab' renderer only for Colab web notebooks by kevineger · Pull Request #5473 · plotly/plotly.py

@kevineger

The current implementation detects if the `google.colab` module is available. This has a couple problems:

1. Anyone can install that library, outside of Colab.
2. The recently launched [Colab VS Code extension](https://marketplace.visualstudio.com/items?itemName=Google.colab) does not work with that web-based renderer.

Snapping to the conventions used for the other notebooks/renderers (e.g. Kaggle, Azure), this change now looks for the presence of the `COLAB_NOTEBOOK_ID` environment variable. I'm an engineer on Colab and have verified that we set this on kernel init for all notebooks accessed through our web app (https://colab.research.google.com/).

More context in plotly#5471.

This was referenced

Jan 21, 2026

@kevineger

@kevineger