From 7bbd493a073e9568f1b4b9ff7669890480e7ea6a Mon Sep 17 00:00:00 2001 From: philippe Date: Mon, 8 Jan 2024 09:39:17 -0500 Subject: [PATCH 1/5] Remove ansi2html. --- dash/_jupyter.py | 18 +----------------- requires-install.txt | 1 - 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/dash/_jupyter.py b/dash/_jupyter.py index 4bc5d59493..ceab68b6bf 100644 --- a/dash/_jupyter.py +++ b/dash/_jupyter.py @@ -5,7 +5,6 @@ import os import queue import uuid -import re import sys import threading import time @@ -22,7 +21,6 @@ from IPython.core.display import HTML from IPython.core.ultratb import FormattedTB from retrying import retry - from ansi2html import Ansi2HTMLConverter from ipykernel.comm import Comm import nest_asyncio @@ -471,21 +469,7 @@ def _wrap_errors(error): if self.inline_exceptions: print(ansi_stacktrace) - # Use ansi2html to convert the colored ANSI string to HTML - conv = Ansi2HTMLConverter(scheme="ansi2html", dark_bg=False) - html_str = conv.convert(ansi_stacktrace) - - # Set width to fit 75-character wide stack trace and font to a size the - # won't require a horizontal scroll bar - html_str = html_str.replace( - "", '' - ) - - # Remove explicit background color so Dash dev-tools can set background - # color - html_str = re.sub("background-color:[^;]+;", "", html_str) - - return html_str, 500 + return ansi_stacktrace, 500 @property def active(self): diff --git a/requires-install.txt b/requires-install.txt index b4aed45cd7..1b34a0cf49 100644 --- a/requires-install.txt +++ b/requires-install.txt @@ -10,6 +10,5 @@ contextvars==2.4;python_version<"3.7" typing_extensions>=4.1.1 requests retrying -ansi2html nest-asyncio setuptools From 70a651b4833e1f0b3bf911509c1ff5907f62e995 Mon Sep 17 00:00:00 2001 From: philippe Date: Mon, 8 Jan 2024 13:36:19 -0500 Subject: [PATCH 2/5] Lock mimesis<=11.1.0 --- requires-ci.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requires-ci.txt b/requires-ci.txt index 8e5f84ac6d..6bdd07d63b 100644 --- a/requires-ci.txt +++ b/requires-ci.txt @@ -7,7 +7,7 @@ flake8==3.9.2 flaky==3.7.0 flask-talisman==1.0.0 isort==4.3.21;python_version<"3.7" -mimesis +mimesis<=11.1.0 mock==4.0.3 numpy<=1.25.2 orjson==3.5.4;python_version<"3.7" From cc62bb87ea69b0dad2d258782593137b92f5fe80 Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 9 Jan 2024 10:10:01 -0500 Subject: [PATCH 3/5] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa5f960a18..4891531bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## Changed - [#2652](https://github.com/plotly/dash/pull/2652) dcc.Clipboard supports htm_content and triggers a copy to clipboard when n_clicks are changed +- [#2721](https://github.com/plotly/dash/pull/2721) Remove ansi2html, fixes [#2613](https://github.com/plotly/dash/issues/2713) ## [2.14.2] - 2023-11-27 From baa9a6d8b1cc7c26ddc3474d221762869f95c8a3 Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 9 Jan 2024 11:20:54 -0500 Subject: [PATCH 4/5] Use NoColor Ipython formatted stacktrace. --- dash/_jupyter.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dash/_jupyter.py b/dash/_jupyter.py index ceab68b6bf..d383efd419 100644 --- a/dash/_jupyter.py +++ b/dash/_jupyter.py @@ -448,13 +448,12 @@ def _wrap_errors(error): original_formatargvalues = inspect.formatargvalues inspect.formatargvalues = _custom_formatargvalues try: - # Use IPython traceback formatting to build colored ANSI traceback - # string + # Use IPython traceback formatting to build the traceback string. ostream = io.StringIO() ipytb = FormattedTB( tb_offset=skip, mode="Verbose", - color_scheme="Linux", + color_scheme="NoColor", include_vars=True, ostream=ostream, ) @@ -463,13 +462,12 @@ def _wrap_errors(error): # Restore formatargvalues inspect.formatargvalues = original_formatargvalues - # Print colored ANSI representation if requested - ansi_stacktrace = ostream.getvalue() + stacktrace = ostream.getvalue() if self.inline_exceptions: - print(ansi_stacktrace) + print(stacktrace) - return ansi_stacktrace, 500 + return stacktrace, 500 @property def active(self): From 0ebc5533e39df37a7e84b8c048a069f8e1cc8adb Mon Sep 17 00:00:00 2001 From: philippe Date: Tue, 9 Jan 2024 11:51:56 -0500 Subject: [PATCH 5/5] build