-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommended way to detect interactive terminal? #1024
Comments
An env var would be great. Or setting Having said that, I see you're already setting |
Based on that link, it seems like |
But we could set both since |
I'm maintaining the termcolor colour library and recently added tty detection, so colour is disabled for things like pipes:
https://github.com/termcolor/termcolor/blob/ec269e608a08b33beb739b6ab5f17b9217a5692a/src/termcolor/termcolor.py#L106-L118
Unfortunately this means colour is disabled in Jupyter/JupyterLab: termcolor/termcolor#28
I see there was a plan to set
isatty
toTrue
foripykernel.iostream.OutStream
, but instead it was made configurable to make sure things like pagers (less, more) didn't get confused:So at the moment, if a Jupyter user wants colour from termcolor, they need to either set an env var
FORCE_COLOR=1
, or configureipykernel.iostream.OutStream
soisatty=True
.But if we wanted to add auto-detection to termcolor's
_can_do_colour
, what sort of thing should we query to know Jupyter is being used in an interactive way?Thank you!
The text was updated successfully, but these errors were encountered: