Skip to content

Commit 000ec18

Browse files
authored
Merge pull request #2721 from plotly/remove-ansi2html
Remove ansi2html.
2 parents 7527383 + 0ebc553 commit 000ec18

File tree

4 files changed

+7
-25
lines changed

4 files changed

+7
-25
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
99

1010
## Changed
1111
- [#2652](https://github.com/plotly/dash/pull/2652) dcc.Clipboard supports htm_content and triggers a copy to clipboard when n_clicks are changed
12+
- [#2721](https://github.com/plotly/dash/pull/2721) Remove ansi2html, fixes [#2613](https://github.com/plotly/dash/issues/2713)
1213

1314
## [2.14.2] - 2023-11-27
1415

dash/_jupyter.py

+5-23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import queue
77
import uuid
8-
import re
98
import sys
109
import threading
1110
import time
@@ -22,7 +21,6 @@
2221
from IPython.core.display import HTML
2322
from IPython.core.ultratb import FormattedTB
2423
from retrying import retry
25-
from ansi2html import Ansi2HTMLConverter
2624
from ipykernel.comm import Comm
2725
import nest_asyncio
2826

@@ -450,13 +448,12 @@ def _wrap_errors(error):
450448
original_formatargvalues = inspect.formatargvalues
451449
inspect.formatargvalues = _custom_formatargvalues
452450
try:
453-
# Use IPython traceback formatting to build colored ANSI traceback
454-
# string
451+
# Use IPython traceback formatting to build the traceback string.
455452
ostream = io.StringIO()
456453
ipytb = FormattedTB(
457454
tb_offset=skip,
458455
mode="Verbose",
459-
color_scheme="Linux",
456+
color_scheme="NoColor",
460457
include_vars=True,
461458
ostream=ostream,
462459
)
@@ -465,27 +462,12 @@ def _wrap_errors(error):
465462
# Restore formatargvalues
466463
inspect.formatargvalues = original_formatargvalues
467464

468-
# Print colored ANSI representation if requested
469-
ansi_stacktrace = ostream.getvalue()
465+
stacktrace = ostream.getvalue()
470466

471467
if self.inline_exceptions:
472-
print(ansi_stacktrace)
468+
print(stacktrace)
473469

474-
# Use ansi2html to convert the colored ANSI string to HTML
475-
conv = Ansi2HTMLConverter(scheme="ansi2html", dark_bg=False)
476-
html_str = conv.convert(ansi_stacktrace)
477-
478-
# Set width to fit 75-character wide stack trace and font to a size the
479-
# won't require a horizontal scroll bar
480-
html_str = html_str.replace(
481-
"<html>", '<html style="width: 75ch; font-size: 0.86em">'
482-
)
483-
484-
# Remove explicit background color so Dash dev-tools can set background
485-
# color
486-
html_str = re.sub("background-color:[^;]+;", "", html_str)
487-
488-
return html_str, 500
470+
return stacktrace, 500
489471

490472
@property
491473
def active(self):

requires-ci.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ flake8==3.9.2
77
flaky==3.7.0
88
flask-talisman==1.0.0
99
isort==4.3.21;python_version<"3.7"
10-
mimesis
10+
mimesis<=11.1.0
1111
mock==4.0.3
1212
numpy<=1.25.2
1313
orjson==3.5.4;python_version<"3.7"

requires-install.txt

-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ contextvars==2.4;python_version<"3.7"
1010
typing_extensions>=4.1.1
1111
requests
1212
retrying
13-
ansi2html
1413
nest-asyncio
1514
setuptools

0 commit comments

Comments
 (0)