fix: Remove global warning format side effect by emmanuel-ferdman · Pull Request #5481 · plotly/plotly.py
-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Merged
Conversation
Code PR
- I have read through the contributing notes and understand the structure of the package.
- 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.
Summary
Importing plotly.tools or plotly.offline overwrites Python's global warnings.formatwarning. This changes how all warnings look, not just plotly's. Breaks output for user code and other libraries. The custom format was added in 2014 for cosmetic reasons but the global side effect was unintended. This PR removes it because Python's default format works.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this change @emmanuel-ferdman ! We're not terribly attached to our custom warning format, and changing the format globally obviously isn't good behavior, so I do think the best fix here is indeed to remove the custom formatting altogether.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters