Skip to content

Commit

Permalink
allow style support for Jupyter on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
leshnabalara authored and davidism committed Feb 25, 2021
1 parent 80086c4 commit 43d1bcf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Unreleased
``default=None``. :issue:`1381`
- Option prompts validate the value with the option's callback in
addition to its type. :issue:`457`
- Allow styled output in Jupyter on Windows. :issue:`1271`


Version 7.1.2
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,8 @@ warn_unreachable = True
[mypy-click]
no_implicit_reexport = False

[mypy-colorama.*]
ignore_missing_imports = True

[mypy-importlib_metadata.*]
ignore_missing_imports = True
7 changes: 1 addition & 6 deletions src/click/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,6 @@ def strip_ansi(value):


def _is_jupyter_kernel_output(stream):
if WIN:
# TODO: Couldn't test on Windows, should't try to support until
# someone tests the details wrt colorama.
return

while isinstance(stream, (_FixupStream, _NonClosingTextIOWrapper)):
stream = stream._stream

Expand Down Expand Up @@ -521,7 +516,7 @@ def auto_wrap_for_ansi(

strip = should_strip_ansi(stream, color)
ansi_wrapper = colorama.AnsiToWin32(stream, strip=strip)
rv = ansi_wrapper.stream
rv = t.cast(t.TextIO, ansi_wrapper.stream)
_write = rv.write

def _safe_write(s):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import pytest

from click._compat import should_strip_ansi
from click._compat import WIN


@pytest.mark.xfail(WIN, reason="Jupyter not tested/supported on Windows")
def test_is_jupyter_kernel_output():
class JupyterKernelFakeStream:
pass
Expand Down

0 comments on commit 43d1bcf

Please sign in to comment.