Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suppress DeprecationWarning when updating template.data #5080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
emilykl merged 4 commits into main from fix-bogus-deprecationwarning
Mar 13, 2025

Conversation

@emilykl
Copy link
Contributor

@emilykl emilykl commented Mar 12, 2025
edited
Loading

Closes #4997

The Mapbox deprecation warning added to go.Scattermapbox in #4900 is falsely triggered whenever a px figure is created, because the default template contains a 'scattermapbox' key in template.data, which causes a go.Scattermapbox trace object to be created during validation.

The Python warning filters suppress these warnings by default since they are not emitted at the top level, but they may surface in Pytest (which enables all warnings) or for anyone using custom warnings settings.

This PR edits the Template constructor to ignore DeprecationWarnings emitted while setting template.data. It also adds tests to verify that deprecation warnings are correctly emitted.

Note: I've also opened #5081 to track work for removing mapbox and made a note to remove 'scattermapbox' from templates as part of that work.


This reduces the warning noise in our own unit tests as well.

test_optional on main:
Screen Shot 2025年03月12日 at 4 40 08 PM

test_optional on this branch:
Screen Shot 2025年03月12日 at 4 40 44 PM

# go.Scattermapbox trace object to be created during validation.
# In order to prevent false deprecation warnings from surfacing,
# we suppress deprecation warnings for this line only.
with warnings.catch_warnings():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you

assert len(df) > 0


def test_warn_on_deprecated_mapbox_px_constructors():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@emilykl emilykl merged commit 0968434 into main Mar 13, 2025
5 checks passed
@emilykl emilykl deleted the fix-bogus-deprecationwarning branch March 14, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@marthacryan marthacryan Awaiting requested review from marthacryan

1 more reviewer

@gvwilson gvwilson gvwilson approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

DeprecationWarning scattermapbox unrelated trigger

AltStyle によって変換されたページ (->オリジナル) /