Plotly Chart Warning: Why `kwargs` Are No Longer Safe

by Jule 54 views
Plotly Chart Warning: Why `kwargs` Are No Longer Safe

When updating st.plotly_chart to drop the deprecated kwargs, users once saw a clean deprecation notice - but now, a surprising warning appears even with correct width='content'. This isn’t a bug: the library now treats kwargs as syntax errors, not just warnings. Under the hood, Plotly’s config system has shifted - options must be passed via config instead. Streamlit’s latest 1.50.0 flags the warning to push developers toward cleaner, future-proof code. Current behavior blocks width via kwargs, returning a silent fail with show_deprecation_warning. This regression hits even well-formed calls like st.plotly_chart(fig, width='content'). The fix? Drop kwargs and use config - but don’t stop there. Check the full docs: misusing kwargs triggers errors even when width is set. Modern practices favor explicit config to unlock full control. Is this a step back? Yes - smooth, predictable rendering now demands updated code, not old workarounds. The bottom line: update now to avoid breaking your app downstream.