Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Always display WebAgg URL regardless of browser open status#30786
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
rcomer commentedNov 25, 2025
I am not familiar with webagg, but if a url successfully opens in a browser, can the user not see the url in the browser? |
ianhi left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm in general in favor of more aggressive printing out of the url for all the reasons that you note. However, I don't think this is the right approach as leaves anyone using webagg as part of an application with a print statement that they cannot suppress, something that that they may not want.
Ideally there would be an escape hatch for that case.
Summary
Ensures the WebAgg server URL is always displayed to users, even when the browser successfully opens automatically.
Problem
Currently, the URL is only shown when:
webagg.open_in_browserisFalse, ORThis means users never see the URL when the browser opens successfully, making it difficult to:
Solution
Moved the
print(f"To view figure, visit {url}")statement outside the conditional block, ensuring it always executes regardless of the browser open attempt.Changes
lib/matplotlib/backends/backend_webagg.pyFigureManagerWebAgg.pyplot_show()Benefits
Testing
Tested with:
webagg.open_in_browser = True→ URL displays, browser openswebagg.open_in_browser = False→ URL displays, browser doesn't openFixes#15650