Skip to content

Use Windows-specific Colorama initialisation - #12493

Merged
AA-Turner merged 1 commit into
sphinx-doc:masterfrom
jdknight:use-newer-colorama-init
Jul 2, 2024
Merged

AA-Turner merged 1 commit into
sphinx-doc:masterfrom
jdknight:use-newer-colorama-init

Conversation

@jdknight

Copy link
Copy Markdown
Contributor

Feature or Bugfix

  • Bugfix

Purpose

Colorama has a newer just_fix_windows_console call (v0.4.6+) which provides a better initialization for Windows consoles. This should improve a user's colored terminal experience when using other scripts/utilities that may use multiple Sphinx instances over the life-cycle of a run.

Detail

This is most likely outside the supported use cases for Sphinx but this change is driven to help the user experience when performing testing a third-party Sphinx extension. When testing for a third-party extension, the Sphinx application is built through a utility call that can be used to create multiple instances over time in unit and other testing. Noticed when in a Windows environment, if a second instance of Sphinx is created, the color becomes disabled in the console. Stumbled upon an issue which looked to be related to this case and a specific comment suggests to use a just_fix_windows_console call instead. Testing between two versions of Sphinx with changing the initialization call seemed to show an improved experience.

Before:

image

After:

image

Relates

Colorama has a newer `just_fix_windows_console` call (v0.4.6+; [1])
which provides a better initialization for Windows consoles. This should
improve a user's colored terminal experience when using other
scripts/utilities that may use multiple Sphinx instances over the
life-cycle of a run.

[1]: https://github.com/tartley/colorama?tab=readme-ov-file#usage

Signed-off-by: James Knight <[email protected]>
@jayaddison jayaddison added dependencies Pull requests that update a dependency file internals:other python Pull requests that update Python code labels Jun 30, 2024
@AA-Turner AA-Turner changed the title [console]: use newer Colorama initialization Use Windows-specific Colorama initialisation Jul 2, 2024
@AA-Turner

Copy link
Copy Markdown
Member

Thanks!

@AA-Turner
AA-Turner merged commit f0c5178 into sphinx-doc:master Jul 2, 2024
@jdknight
jdknight deleted the use-newer-colorama-init branch July 2, 2024 23:15
@AA-Turner AA-Turner added this to the 7.4.0 milestone Jul 13, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dependencies Pull requests that update a dependency file internals:other python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants