Repository navigation
runnable: set FORCE_COLOR for a Python run with runnable.outputLang=ansi - #47
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
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.
A Python run with
runnable.outputLang=ansinow hasFORCE_COLOR=1in its environment. Rich, rich-click and Typer print colours with no change to the code. Before, authors had to setFORCE_COLORin a hidden line, which was the last workaround left in a runnable rich-click--helpblock after #43.color: truetorun()when the block hasrunnable.outputLang=ansi, from thedata-scb-runnable-ansiattribute that the client already reads for the output.FORCE_COLOR=1before such a run, and removes it before any other run, as it does forCOLUMNS. It already resets Rich's cached console before each run, so the new value takes effect.colorin the options ofrun(). TheRuntimetype and the runtime guide describe it. The JavaScript runtime ignores it, since JavaScript code prints colour codes itself.FORCE_COLOR, in place of telling authors to set it.FORCE_COLORline for rich-click or Typer.DECISIONS.mdand the changelog have entries too. The changelog entry is under Unreleased, for 1.5.0.release-1.5.0needs this commit, and its changelog entry moved into the 1.5.0 section.Tests
✔ Builtin bold, in a colour that differs from the plain output. It runs in one project, as the other Pyodide tests do. The example indexes after it inrunnable.test.tsmove up by one.pnpm lint,pnpm lint:docsandpnpm test(606 unit tests and 8 script tests) pass. The runnable and compat Playwright specs pass: 43 passed, 17 skipped.hello.pywithrunnable.args="--help" runnable.outputLang=ansiand no hidden lines, and its help printed in colour.🤖 Generated with Claude Code