Skip to content
Myr

allow style support for Jupyter on Windows

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by leshna balara · committed by David Lord · parent 80086c4 · Browse files · 4 files+5 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+5 added−10 removed

  • tests:+0 added−4 removed
  • other:+5 added−6 removed

4 files+5 added−10 removed

modified:src/click/_compat.py+1 added-6 removed
469 unmodified lines
470 return _ansi_re.sub("", value)471472473def _is_jupyter_kernel_output(stream):474 if WIN:475 # TODO: Couldn't test on Windows, should't try to support until476 # someone tests the details wrt colorama.477 return478474 while isinstance(stream, (_FixupStream, _NonClosingTextIOWrapper)):475 stream = stream._stream476477 return stream.__class__.__module__.startswith("ipykernel.")
37 unmodified lines
515 import colorama516517 strip = should_strip_ansi(stream, color)518 ansi_wrapper = colorama.AnsiToWin32(stream, strip=strip)524 rv = ansi_wrapper.stream519 rv = t.cast(t.TextIO, ansi_wrapper.stream)520 _write = rv.write521522 def _safe_write(s):523 try:
73 unmodified lines
modified:tests/test_compat.py-4 removed
1import pytest21from click._compat import should_strip_ansi4from click._compat import WIN237@pytest.mark.xfail(WIN, reason="Jupyter not tested/supported on Windows")4def test_is_jupyter_kernel_output():5 class JupyterKernelFakeStream:6 pass7
3 unmodified lines
modified:CHANGES.rst+1 added
168 unmodified lines
169- ``click.confirm()`` will prompt until input is given if called with170 ``default=None``. :issue:`1381`171- Option prompts validate the value with the option's callback in172 addition to its type. :issue:`457`173- Allow styled output in Jupyter on Windows. :issue:`1271`174175176Version 7.1.2177-------------
635 unmodified lines
modified:setup.cfg+3 added
93 unmodified lines
9495[mypy-click]96no_implicit_reexport = False9798[mypy-colorama.*]99ignore_missing_imports = True100101[mypy-importlib_metadata.*]102ignore_missing_imports = True