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: Show module names instead of file paths in flamegraph by ivonastojanovic · Pull Request #146040 · python/cpython

Conversation

@ivonastojanovic

@ivonastojanovic ivonastojanovic commented Mar 16, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Display module names instead of full file paths (/home/user/project/pkg/mod.py → pkg.mod) in flamegraph for readability.

image

CC: @pablogsal @lkollar

The issue:

Show module names instead of full file paths — /home/user/project/pkg/mod.py → pkg.mod for readability

  • 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 requested a review from pablogsal as a code owner March 16, 2026 20:18
@ivonastojanovic ivonastojanovic added the skip news label Mar 16, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Mar 16, 2026
Improve Tachyon UX #142927
Open
11 tasks done
@bedevere-app bedevere-app Bot added the awaiting review label Mar 16, 2026
@picnixz

picnixz commented Mar 17, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

As I am on mobile it is hard to review but is it possible to have an option to keep showing full paths? this may help if we want to open the file in an IDE. Or does this change only affect the flamegraph output?

Alternative: show the full path of the selected cell as a footer

All reactions

Sorry, something went wrong.

Uh oh!

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

@ivonastojanovic
ivonastojanovic force-pushed the flamegraph_modules branch from a3d38ad to b5eeefb Compare March 20, 2026 19:53
@ivonastojanovic

ivonastojanovic commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

As I am on mobile it is hard to review but is it possible to have an option to keep showing full paths? this may help if we want to open the file in an IDE. Or does this change only affect the flamegraph output?

Alternative: show the full path of the selected cell as a footer

@picnixz That’s a great idea. I’ve added a toggle that lets users switch between full paths and module names. Toggling it updates both the flamegraph frames and the hover tooltips. This change only affects the flamegraph output. Let me know what you think of the toggle.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented Mar 20, 2026

Copy link
Copy Markdown
Member

Toggling was one solution I had in mind so it is fine! showing full path without toggling as a small footer with a "copy path" if you were to double click the footer would also be an alternative/follow-up improvement.

Otherwise just toggling is great! thanks!

All reactions

Sorry, something went wrong.

Uh oh!

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

@ivonastojanovic
ivonastojanovic force-pushed the flamegraph_modules branch from b5eeefb to 518c923 Compare March 31, 2026 14:20
pablogsal
pablogsal reviewed Apr 4, 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.

some comments

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/profiling/sampling/module_utils.py Resolved

Uh oh!

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

Comment thread Lib/profiling/sampling/module_utils.py Resolved

Uh oh!

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

Comment thread Lib/profiling/sampling/stack_collector.py Resolved

Uh oh!

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

pablogsal
pablogsal reviewed Apr 4, 2026
View reviewed changes
Comment thread Lib/profiling/sampling/_flamegraph_assets/flamegraph.js Outdated
if (useModuleNames) {
return moduleName || filename;
}
return filename ? filename.split('/').pop() : filename;

@pablogsal pablogsal Apr 4, 2026

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.

The toggle is labeled "Full Paths" but this returns filename.split("/").pop() which is the basename. Also the tooltip builds displayName differently (using the full filename), so different parts of the UI disagree on what to show.

Sorry, something went wrong.

Uh oh!

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

All reactions

@ivonastojanovic ivonastojanovic Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

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.

What do you think about “File Paths” and “Module Names”? I updated displayName to return the filename and kept the tooltip showing the full path, does that sound okay?

Sorry, something went wrong.

Uh oh!

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

All reactions
ivonastojanovic added 8 commits April 7, 2026 16:21
@ivonastojanovic
Extract module name utilities to module_utils.py
e0e7d03
Move module name extraction logic from heatmap_collector to shared
module_utils to enable flamegraph to display module names instead of
full file paths.
@ivonastojanovic
Show module names instead of file paths in flamegraph
75e120b
Display module names instead of full file paths
(/home/user/project/pkg/mod.py → pkg.mod) in flamegraph for
readability.
@ivonastojanovic
Add 'Full Paths/Module Names' toggle for flamegraph display
44599a4
Users can now switch between module names and file paths using the
toggle in the View Mode sidebar. Module names are concise, while
file paths help locate the exact source file, both are useful
depending on the debugging context.
@ivonastojanovic
Rename module_name/name_module to module/label in flamegraph data
9b17680
@ivonastojanovic
Fix module name for files not on sys.path
ee3aeaa
_path_to_module included the root separator (/ or drive letter)
when converting absolute paths to dotted module names, producing
/.tmp.project.main instead of tmp.project.main.
@ivonastojanovic
Simplify module path resolution in module_utils
eee3ce4
Replace _is_subpath helper with Path.is_relative_to() (available
since 3.9), removing the double relative_to() call.
@ivonastojanovic
Add label field to root nodes for module-name toggle
26b4f18
@ivonastojanovic
Fix display name consistency in flamegraph toggle
36764cb
Rename "Full Paths" to "File Paths", remove basename-only
.split('/').pop() so tooltip, hotspots, and search all show the
same path in file-paths mode.
@ivonastojanovic
ivonastojanovic force-pushed the flamegraph_modules branch from 518c923 to 36764cb Compare April 7, 2026 15:35
@ivonastojanovic
ivonastojanovic requested a review from pablogsal April 7, 2026 15:37
@pablogsal
pablogsal merged commit d4eee16 into python:main Apr 29, 2026
48 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting review label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner

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 @picnixz @pablogsal
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.