GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-142927: Auto-open HTML output in browser after generation by ivonastojanovic · Pull Request #143178 · python/cpython

Conversation

@ivonastojanovic

@ivonastojanovic ivonastojanovic commented Dec 25, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Automatically open flamegraph and heatmap HTML output in the default browser after profiling completes. Add --no-browser flag to disable this behavior.

Towards #142927.

CC: @pablogsal @lkollar

  • Issue: Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools #138122
  • Issue: Improve Tachyon UX #142927

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ivonastojanovic ivonastojanovic added the skip news label Dec 25, 2025
@ivonastojanovic
ivonastojanovic requested a review from pablogsal as a code owner December 25, 2025 18:03
@bedevere-app bedevere-app Bot mentioned this pull request Dec 25, 2025
Implement PEP 799 – A dedicated profiling package for organizing Python profiling tools #138122
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Dec 25, 2025
@pablogsal

pablogsal commented Dec 25, 2025

Copy link
Copy Markdown
Member

You probably need to update the test to NOT open the browser by default and make the CLI the only that sets that option to True :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal pablogsal changed the title gh-138122: Auto-open HTML output in browser after generation gh-142927: Auto-open HTML output in browser after generation Dec 25, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Dec 25, 2025
Improve Tachyon UX #142927
Open
11 tasks done
@pablogsal

pablogsal commented Dec 25, 2025

Copy link
Copy Markdown
Member

Changing the issue to gh-142927

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Dec 25, 2025

Copy link
Copy Markdown
Member

And we also need to mention something related to this behavior in the docs

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal reviewed Dec 25, 2025
View reviewed changes
Comment thread Lib/profiling/sampling/cli.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal reviewed Dec 25, 2025
View reviewed changes
Comment thread Lib/profiling/sampling/cli.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Dec 25, 2025

Copy link
Copy Markdown
Member

Some tests re opening browsers now 😆

You probably want this diff at least:

diff --git a/Lib/test/test_profiling/test_sampling_profiler/test_children.py b/Lib/test/test_profiling/test_sampling_profiler/test_children.py
index b7dc878a238..3d6db7dcb56 100644
--- a/Lib/test/test_profiling/test_sampling_profiler/test_children.py
+++ b/Lib/test/test_profiling/test_sampling_profiler/test_children.py
@@ -992,6 +992,7 @@ def test_subprocesses_flag_with_flamegraph_output(self):
                     "-r",
                     "100",
                     "--flamegraph",
+                    "--no-browser",
                     "-o",
                     output_file,
                     script_file,
ivonastojanovic reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danielhollas

danielhollas commented Dec 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Hey, 👋

sorry for a drive-by comment, just wanted to chime in with a specific use case: the default behaviour you're introducing here is suuuper annoying when being logged in via SSH (and based on my experience it's too easy to forget the --no-browser option 🙈).

According to this post, it might be possible (at least on best effort basis) to check some environment variables to detect the SSH connection, and perhaps disable the browser-opening automatically in that case?

If that sounds reasonable I can do a bit of testing for SSH detection tomorrow. The biggest disadvantage I see that it would make the default behaviour less trivial to explaing to users...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ivonastojanovic

ivonastojanovic commented Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

Hey, 👋

sorry for a drive-by comment, just wanted to chime in with a specific use case: the default behaviour you're introducing here is suuuper annoying when being logged in via SSH (and based on my experience it's too easy to forget the --no-browser option 🙈).

According to (this post)[https://unix.stackexchange.com/a/9607], it might be possible (at least on best effort basis) to check some environment variables to detect the SSH connection, and perhaps disable the browser-opening automatically in that case?

If that sounds reasonable I can do a bit of testing for SSH detection tomorrow. The biggest disadvantage I see that it would make the default behaviour less trivial to explaing to users...

Hey! After thinking about it a bit more, I agree with you 🙂 It does seem more annoying to forget to set --no-browser than to just have the behavior disabled by default and turn it on with --browser when we actually need it. I’ll go ahead and change the default to false, having it enabled by default feels easier to forget and more likely to cause issues in these cases.

danielhollas reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ivonastojanovic
Add --browser flag to auto-open HTML output after generation
2d6e994
Add a --browser flag that automatically opens the generated
flamegraph and heatmap HTML files in the default browser once
profiling completes.
@ivonastojanovic
ivonastojanovic force-pushed the auto_open_browser branch from 6c5bc60 to 2d6e994 Compare December 31, 2025 11:39
@ivonastojanovic
ivonastojanovic requested a review from pablogsal December 31, 2025 11:43
@danielhollas

danielhollas commented Dec 31, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Another, somewhat middle-ground, option would be to have a prompt to open a browser; this is only one or two keystrokes less convenient than launching the browser automatically, but avoids the pitfalls mentioned above. This is what we do in one of our CLI apps and I quite like it, but I know having prompts might be controversial for some.

image

(in our case, one can pass --no-browser to disable the prompt)

image

I wonder if printing a URL that one can copy-paste would work in this case as well?

btw: I love what you guys are doing with the new profiler, can't wait to try it out. 🫶 🤘

pablogsal and ivonastojanovic reacted with heart emoji
All reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal approved these changes Jan 1, 2026
View reviewed changes

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

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.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jan 1, 2026
@pablogsal

pablogsal commented Jan 1, 2026

Copy link
Copy Markdown
Member

Given the restrictions i think for now the best course of action is making it opt-in! Great work @ivonastojanovic

ivonastojanovic reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal
pablogsal merged commit 5d13335 into python:main Jan 1, 2026
50 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jan 1, 2026
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
@ivonastojanovic @thunder-coding
pythongh-142927: Auto-open HTML output in browser after generation (p…
d80b1bd
…ython#143178)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ivonastojanovic @pablogsal @danielhollas
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.