diff --git a/plotly/matplotlylib/renderer.py b/plotly/matplotlylib/renderer.py index d55f86ef3c2..151b016679d 100644 --- a/plotly/matplotlylib/renderer.py +++ b/plotly/matplotlylib/renderer.py @@ -19,7 +19,9 @@ def warning_on_one_line(msg, category, filename, lineno, file=None, line=None): return "%s:%s: %s:\n\n%s\n\n" % (filename, lineno, category.__name__, msg) -warnings.formatwarning = warning_on_one_line +# Note: We no longer globally modify warnings.formatwarning to avoid polluting +# the user's warning system. If custom warning formatting is needed internally, +# use warnings.warn_explicit() or format within specific warning calls. class PlotlyRenderer(Renderer): diff --git a/plotly/tools.py b/plotly/tools.py index 67f828204d7..cb3332a781e 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -60,7 +60,9 @@ def warning_on_one_line(message, category, filename, lineno, file=None, line=Non return "%s:%s: %s:\n\n%s\n\n" % (filename, lineno, category.__name__, message) -warnings.formatwarning = warning_on_one_line +# Note: We no longer globally modify warnings.formatwarning to avoid polluting +# the user's warning system. If custom warning formatting is needed internally, +# use warnings.warn_explicit() or format within specific warning calls. ### mpl-related tools ###