FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148352: Add more colour to `calendar` CLI output by hugovk · Pull Request #148354 · python/cpython · GitHub

Repository navigation

gh-148352: Add more colour to calendar CLI output - #148354

Merged
hugovk merged 10 commits into
python:mainfrom
hugovk:3.15-calendar-colour
May 4, 2026
Merged

hugovk merged 10 commits into
python:mainfrom
hugovk:3.15-calendar-colour

Conversation

hugovk commented Apr 10, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

In Python 3.14, we added an amazing colour highlight for today: #128318.

Let's add a touch more colour.

Before After

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

hugovk requested a review from AA-Turner as a code owner April 10, 2026 17:27
hugovk added the stdlib Standard Library Python modules in the Lib/ directory label Apr 10, 2026
Comment thread Doc/library/calendar.rst Outdated
Co-authored-by: Rihaan Meher <sharktidedev@gmail.com>
Comment thread Lib/calendar.py

This comment was marked as resolved.

Co-authored-by: Rihaan Meher <sharktidedev@gmail.com>

sharktide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, thanks @hugovk :)

johnslavik self-requested a review April 14, 2026 23:52
Comment thread Lib/test/test_calendar.py Outdated
@@ -1122,4 +1123,4 @@
self.assertCmdFails(*args)

@support.force_not_colorized

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can be removed, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Removed!

Comment thread Lib/test/test_calendar.py
self.assertCmdFails(*args)

@support.force_not_colorized
def test_help(self):

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we also have a case checking for color?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Added!

Copy link
Copy Markdown

Comment thread Lib/test/test_calendar.py
today = datetime.date(2026, 5, 4)
cal = calendar._CLIDemoCalendar(highlight_day=today)
output = cal.formatmonth(2026, 5)
self.assertIn("\x1b[30m\x1b[43mMay 2026\x1b[0m\n\x1b[36m", output)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hmm, do we support running tests with different themes? If a user has a custom theme this test will fail.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We don't support running tests with different themes.

Other tests could also break if the user changed the theme:

❯ rg "x1b" Lib/test/test_*.py -l | wc -l
      13

Right now the theme API is internal/private. If we make it public in a later release, we'll need to consider tests are with the default theme or a specific theme.

StanFromIreland 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM :-) 🌈

hugovk merged commit 2ba0a81 into python:main May 4, 2026
64 checks passed
hugovk deleted the 3.15-calendar-colour branch May 4, 2026 12:15

hugovk commented May 4, 2026

Copy link
Copy Markdown
Member Author

Thanks @sharktide and @StanFromIreland for the reviews!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL