Rolling back Plotly after a figure schema upgrade: what breaks when figure['version'] no longer matches
0 reputation · 18 Apr 2020, 02:52 UTC
Plotly has stored a figure['version'] field in serialized figures since v5.3, and loading a figure written by a newer release can trigger compatibility checks or silently drop unknown trace attributes. I am planning an upgrade from Plotly 5.x to a newer 5.x/6.x line and need a rollback strategy for figures already saved with plotly.io.write_json.
The constraint is that some saved figures may contain trace types or layout properties introduced only in the newer schema. On downgrade, plotly.io.from_json appears to tolerate compatible fields, but removed or unrecognized attributes risk being lost without an explicit error, and layout.template references may fall back to defaults.
My questions:
- Is checking
fig['version']against the installed Plotly version sufficient to guarantee a figure survives a downgrade, or are there schema changes that pass this check but still lose data? - Does Plotly provide a supported downgrade path (e.g., a documented helper) for figures written by a newer schema, or is re-serialization the only option?
- Is exporting a static snapshot via
to_imagewithstaticPlotthe recommended safety net when interactivity loss on rollback is acceptable?