Skip to content

Add missing stacklevel=2 to 9 warnings.warn() calls#3738

Open
stef41 wants to merge 1 commit intoplotly:devfrom
stef41:fix/add-missing-stacklevel-to-warnings
Open

Add missing stacklevel=2 to 9 warnings.warn() calls#3738
stef41 wants to merge 1 commit intoplotly:devfrom
stef41:fix/add-missing-stacklevel-to-warnings

Conversation

@stef41
Copy link
Copy Markdown

@stef41 stef41 commented Apr 11, 2026

Description

Without stacklevel, warnings.warn() reports the location of the warn() 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=2 to all 9 warnings.warn() calls across 7 files that were missing it.

Files changed

  • dash/_callback_context.py — deprecated outputs_list, inputs_list, states_list properties
  • dash/dash.py — JupyterDash deprecation warning
  • dash/resources.pyserve_locally config warning
  • dash/development/base_component.py — component deprecation
  • dash/development/_jl_components_generation.py — Julia reserved keyword warning
  • dash/development/_r_components_generation.py — R reserved keyword warning
  • dash/testing/browser.py — non-Chrome log warning

Why this matters

When a user accesses a deprecated property like callback_context.outputs_list, the warning currently points to dash/_callback_context.py:177 instead of the user's own code. With stacklevel=2, warnings correctly point to the caller's location, making it much easier to find and fix the issue.

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.
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.

1 participant