Add missing stacklevel=2 to 9 warnings.warn() calls#3738
Open
stef41 wants to merge 1 commit intoplotly:devfrom
Open
Add missing stacklevel=2 to 9 warnings.warn() calls#3738stef41 wants to merge 1 commit intoplotly:devfrom
stef41 wants to merge 1 commit intoplotly:devfrom
Conversation
Without stacklevel, warnings.warn() reports the location of the warn() call itself rather than the caller's location, making it harder for users to identify the source of the warning in their own code. This adds stacklevel=2 to all 9 warnings.warn() calls across 7 files that were missing it.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Without
stacklevel,warnings.warn()reports the location of thewarn()call itself rather than the caller's location. This makes it harder for users to identify where the warning originates in their own code.This adds
stacklevel=2to all 9warnings.warn()calls across 7 files that were missing it.Files changed
dash/_callback_context.py— deprecatedoutputs_list,inputs_list,states_listpropertiesdash/dash.py— JupyterDash deprecation warningdash/resources.py—serve_locallyconfig warningdash/development/base_component.py— component deprecationdash/development/_jl_components_generation.py— Julia reserved keyword warningdash/development/_r_components_generation.py— R reserved keyword warningdash/testing/browser.py— non-Chrome log warningWhy this matters
When a user accesses a deprecated property like
callback_context.outputs_list, the warning currently points todash/_callback_context.py:177instead of the user's own code. Withstacklevel=2, warnings correctly point to the caller's location, making it much easier to find and fix the issue.