Skip to content

gh-138122: Integrate live profiler TUI with _colorize theming system - #142360

Merged
pablogsal merged 11 commits into
python:mainfrom
pablogsal:gh-138122-colors
Jan 1, 2026
Merged

gh-138122: Integrate live profiler TUI with _colorize theming system#142360
pablogsal merged 11 commits into
python:mainfrom
pablogsal:gh-138122-colors

Conversation

@pablogsal

@pablogsalpablogsal commented Dec 6, 2025

Copy link
Copy Markdown
Member

The Tachyon profiler's curses-based TUI now uses the centralized theming
infrastructure in _colorize.py, enabling users to customize colors via
the standard Python theming API. This adds a LiveProfiler theme section
with two pre-configured themes: the default dark theme optimized for
dark terminal backgrounds, and LiveProfilerLight for white/light
backgrounds. Users can switch themes by calling _colorize.set_theme() in
their PYTHONSTARTUP or sitecustomize.py.

The table header rendering was also improved to draw a continuous
background, eliminating visual gaps between columns when using reverse
video styling.

…ystem
The Tachyon profiler's curses-based TUI now uses the centralized theming
infrastructure in _colorize.py, enabling users to customize colors via
the standard Python theming API. This adds a LiveProfiler theme section
with two pre-configured themes: the default dark theme optimized for
dark terminal backgrounds, and LiveProfilerLight for white/light
backgrounds. Users can switch themes by calling _colorize.set_theme() in
their PYTHONSTARTUP or sitecustomize.py.
The table header rendering was also improved to draw a continuous
background, eliminating visual gaps between columns when using reverse
video styling.
@picnixz

Copy link
Copy Markdown
Member

Users can switch themes by calling _colorize.set_theme() in their PYTHONSTARTUP or sitecustomize.py.

I thought that this wasn't yet ready for public interface? should we really advertise this feature in the NEWS (cc @hugovk)

Comment threadLib/_colorize.py
@pablogsal

Copy link
Copy Markdown
MemberAuthor

Users can switch themes by calling _colorize.set_theme() in their PYTHONSTARTUP or sitecustomize.py.

I thought that this wasn't yet ready for public interface? should we really advertise this feature in the NEWS (cc @hugovk)

Is not but eventually that will be the mechanism. I can change the news entry if you want

@picnixz

Copy link
Copy Markdown
Member

Originally, I preferred not advertising this interface officially for now otherwise users could assume that they can freely use it as they want (and we don't know how we eventually want to document and expose it) but I saw that we had other NEWS entries that mentioned _colorize so... maybe just say that changing this should be at their own risk?

@hugovk

Copy link
Copy Markdown
Member

Yep, hopefully we'll have something public for 3.15. In the meantime we could say experimental.

Comment threadMisc/NEWS.d/next/Library/2025-12-06-19-49-20.gh-issue-138122.m3EF9E.rst Outdated
Comment threadLib/_colorize.py
Comment threadLib/_colorize.py Outdated
Comment threadLib/_colorize.py Outdated
Comment threadLib/_colorize.py Outdated
Comment threadLib/_colorize.py Outdated
Comment threadLib/profiling/sampling/live_collector/collector.py Outdated
Comment threadLib/profiling/sampling/live_collector/collector.py Outdated
Comment threadLib/profiling/sampling/live_collector/collector.py Outdated
pablogsaland others added 5 commits December 9, 2025 14:55
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Comment threadLib/_colorize.py
Comment threadLib/_colorize.py Outdated
@pablogsal

Copy link
Copy Markdown
MemberAuthor

Fixed merge conflicts

@pablogsal

Copy link
Copy Markdown
MemberAuthor

I think everything should be addressed by now.

@picnixzpicnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I like the mention about "experimental API" but this also makes me wonder whether we should have some "Experimental" section. Do we have APIs in mind that are experimental except _colorize? (C++ had, for a very long time, only experimental::filesystem as an experimental namespace, so having only 1 component in an experimental section would still makes sense IMO).

@pablogsal

Copy link
Copy Markdown
MemberAuthor

Do we have APIs in mind that are experimental except _colorize?

That's pending for @hugovk and @ambv. My understanding is that they plan to expose something in 3.15

@pablogsal

Copy link
Copy Markdown
MemberAuthor

Thanks for the review @picnixz ❤️

@pablogsal
pablogsal merged commit e5ad7b7 into python:mainJan 1, 2026
59 checks passed
@pablogsal
pablogsal deleted the gh-138122-colors branch January 1, 2026 21:10
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…ystem (python#142360)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for freeto 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.

4 participants

@pablogsal@picnixz@hugovk@ambv