Skip to content

Stop overriding global warnings.formatwarning#5506

Open
mosh3eb wants to merge 2 commits intoplotly:mainfrom
mosh3eb:fix/warnings-format-pollution
Open

Stop overriding global warnings.formatwarning#5506
mosh3eb wants to merge 2 commits intoplotly:mainfrom
mosh3eb:fix/warnings-format-pollution

Conversation

@mosh3eb
Copy link

@mosh3eb mosh3eb commented Feb 14, 2026

The interpolation parameter was removed in NumPy 2.4.0 and replaced with 'method'. This was causing create_violin() to fail with newer NumPy versions.

Added version detection to use the correct parameter based on the installed NumPy version, maintaining backward compatibility with NumPy 1.x while supporting 2.4+.

Fixes #5461

Code PR

  • I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the code generator and not the generated files.
  • I have added tests or modified existing tests.
  • For a new feature, I have added documentation examples (please see the doc checklist as well).
  • I have added a CHANGELOG entry if changing anything substantial.
  • For a new feature or a change in behavior, I have updated the relevant docstrings in the code.

Plotly was modifying warnings.formatwarning globally, which affected
the entire Python environment and could break other libraries' warning
output.

Removed the global assignment while keeping the function available
internally if needed. This allows plotly to coexist nicely with other
libraries without polluting the warning system.

Fixes plotly#5472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: create_violin() failure with numpy==2.4.0: TypeError: percentile() got an unexpected keyword argument 'interpolation'

1 participant