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-146609: Add colour to `timeit` CLI output by hugovk · Pull Request #146610 · python/cpython

Conversation

@hugovk

@hugovk hugovk commented Mar 29, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Standard and verbose:

./python.exe -m timeit "'-'.join(str(n) for n in range(100))"
./python.exe -m timeit --verbose "'-'.join(str(n) for n in range(100))"
image

With a warning:

./python.exe -m timeit "import time, random; time.sleep(random.random() * 0.9)"
image

As usual, environment variables can control colour output.

  • Issue: Add colour to timeit CLI output #146609

📚 Documentation preview 📚: https://cpython-previews--146610.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

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

maurycy reacted with heart emoji
All reactions
  • ❤️ 1 reaction
hugovk added 3 commits March 28, 2026 19:29
@hugovk
Add colour to timeit CLI output
2d4380c
@hugovk
Only calculate 'best = min(timings)' once
0f800b3
@hugovk
What's New and blurb
28e8af9
@hugovk
hugovk requested a review from AA-Turner as a code owner March 29, 2026 18:33
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 29, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Mar 29, 2026
Add colour to timeit CLI output #146609
Closed
StanFromIreland
StanFromIreland reviewed Mar 31, 2026
View reviewed changes
Comment thread Lib/test/test_timeit.py Resolved

Uh oh!

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

Comment thread Lib/timeit.py Resolved

Uh oh!

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

hugovk added 2 commits March 31, 2026 18:55
@hugovk
Avoid re-running duplicate tests
f6ef701
@hugovk
Simplify warning colours
ff4c493
StanFromIreland
StanFromIreland reviewed Mar 31, 2026
View reviewed changes
Comment thread Lib/timeit.py Resolved

Uh oh!

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

Comment thread Lib/test/test_timeit.py Resolved

Uh oh!

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

hugovk and others added 3 commits March 31, 2026 20:12
@hugovk @StanFromIreland
Adjust spacing
7e75e56
Co-authored-by: Stan Ulbrych <[email protected]>
@hugovk
Fix space in tests
9636021
@hugovk
Merge branch 'main' into 3.15-timeit-colour
10b19ad
StanFromIreland
StanFromIreland approved these changes Apr 7, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 7, 2026
@ambv

ambv commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Nitpick: I would segment this differently. The fact that the entire line after "raw times:" is just cyan is a wasted opportunity. Would make sense to me to make the commas delimiting the values be colored the same way as the arrows.

All reactions

Sorry, something went wrong.

Uh oh!

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

@hugovk
Use same colour for raw time commas as arrows
9aa8629
@hugovk

hugovk commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

Like this?

image
ambv and StanFromIreland reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@ambv

ambv commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Yes, that looks better to me!

hugovk reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

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

@hugovk
hugovk merged commit 8687b9d into python:main Apr 8, 2026
60 checks passed

Uh oh!

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

@hugovk
hugovk deleted the 3.15-timeit-colour branch April 8, 2026 13:18
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 8, 2026
@hugovk

hugovk commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

Thanks both for the reviews!

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

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

This comment was marked as off-topic.

Sign in to view
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@hugovk @StanFromIreland @ljfp
pythongh-146609: Add colour to timeit CLI output (python#146610)
174508f
Co-authored-by: Stan Ulbrych <[email protected]>
@hugovk hugovk mentioned this pull request May 3, 2026
gh-146609: Use argparse for colour help timeit CLI #149334
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@StanFromIreland StanFromIreland StanFromIreland approved these changes
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

4 participants

@hugovk @ambv @bedevere-bot @StanFromIreland
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.