feat(plotly)!: migrate maps to plotly.js 4
Summary
Closes #7002.
Plotly.js 4 removes the Mapbox traces used by rx.plotly.mapbox. Add rx.plotly.map for MapLibre figures and upgrade all bundles to 4.3.0. Existing Mapbox figures keep rendering in rx.plotly, rx.plotly.map and rx.plotly.mapbox through a rename until 1.0, so the app loads one Plotly.js version.
What changed
- Add the MapLibre bundle with locale, reactive data and event support.
- Deprecate
rx.plotly.mapboxand Mapbox figures in Reflex 0.11.1 with removal scheduled for 1.0.rx.plotly.mapboxloadsplotly.js-map-dist-min@4.3.0; Plotly.js 3.7.0 is no longer a dependency. - Every Plotly component (and subclass) checks the figure for Mapbox traces or
layout.mapbox*keys, including state updates. On a match it logs one browser warning and passes Plotly a copy with MapLibre trace types (scattermapbox→scattermap, etc.), subplot references andlayout.mapbox*keys, in the figure and its animation frames. The user's figure is not changed. Templates,geojson,customdataand button arguments keep their names. Figures without Mapbox names pass through unchanged, so the warning stops once the user migrates. - Render a
Nonestate figure whenlayoutor the default template is set;mergicianthrew onnulland crashed the page (also on main). - Update dependency locks, migration documentation, news fragments and regression coverage.
Verification
- Full unit suite at
a19690c: 11,263 passed and 158 skipped with 73.75% coverage. The review follow-up passes all 20 focused unit tests; all 9 Node-dependent cases skip cleanly when Node.js is unavailable. - Plotly browser suite: 14 passed in development and production using Chrome. Covers migration warnings, loading figures, translated modern and legacy map controls, state updates and click callbacks.
- Upgrade check: an app written on released Reflex 0.11.0 (plotly 6.9) with
rx.plotly.mapbox(literal, state, density, choropleth, two-subplot,fr, animatedpx.scatter_mapbox, relayout buttons) and defaultrx.plotly(literal, state, mixed map + bar) Mapbox plots, rerun in the same folder on this branch. All eleven render with the same center, zoom, size, locale, click result and animation; buttons withmapbox.*relayout paths no longer act, as documented;.web/package.jsonkeeps only Plotly.js 4.3.0. - Ruff lint, formatting,
pyright reflex testsand changed-file pre-commit hooks passed. - All tracked Python files passed Pyright with the Linux platform setting. The macOS all-files hook reports six existing affinity API errors in unchanged Linux benchmark code; other hooks passed.
Deployment notes
All renderers use Plotly.js 4. Mapbox figures keep rendering through the rename until 1.0 and should migrate to MapLibre traces and layout.map. This is still a breaking change for some Mapbox code: Mapbox paths in buttons, sliders and templates no longer act, on_relayout data uses map.* keys, styles hosted by Mapbox (mapbox:// URLs) do not load and the access token is ignored. The docs list these changes. The migration guide also covers removed MathJax 2 support, Chart Studio options, source-reference attributes and changed rendering defaults.