Skip to content

ipython notebook support fo colored output #1185

@RonnyPfannschmidt

Description

@RonnyPfannschmidt

hi, currently click strips colors when used in code invoked by ipython notebooks

after a short chat on the ipython notebook channel i learned that a commonly suggested workaround is

click.utils.should_strip_ansi = lambda *k, **kw: False and that a reasonably reliable way to detect such a stream is stream.__class__.__module__.startswith('ipykernel.')

i propose setting up isatty to check this in the exception case (aka no tty attribute as the jupyter streams dont have one

additional help will be needed from someone with a windows system, as to me it is not clear whether its required to alter the stream wrapping that is used on win32

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions