Customizing your Python REPL's color scheme (Python 3.14+)
Briefly

Customizing your Python REPL's color scheme (Python 3.14+)
"Did you know that Python 3.14 will include syntax highlighting in the REPL? Python 3.14 is due to be officially released in about a month. I recommended tweaking your Python setup now so you'll have your ideal color scheme on release day. But... what if the default syntax colors don't match the colors that your text editor uses? Well, fortunately you can customize your color scheme!"
"Using a PYTHONSTARTUP file You can use a PYTHONSTARTUP file to run code every time a new Python process starts. If Python sees a PYTHONSTARTUP environment variable when it starts up, it will open that file and evaluate the code within it. I have this in my ~/.zshrc file to set the PYTHONSTARTUP environment variable to ~/.startup.py: In my ~/.startup.py file, I have this code:"
Python 3.14 introduces syntax highlighting in the interactive REPL. Default REPL colors may not match a text editor's color scheme, but the REPL color scheme is customizable. Customization can use an undocumented, underscore-prefixed module and should not be relied on for production code. The uv tool can automatically install and run Python 3.14. The PYTHONSTARTUP environment variable can point to a startup file that runs code every time a new Python process starts. Place customization code inside a _main function, call and delete it to avoid polluting the REPL namespace, and use try-except-else to handle older Python versions.
Read at Treyhunner
Unable to calculate read time
[
|
]