Skip to content

Commit a2ab184

Browse files
authored
FIX Make optional IPython import in markdown printer optional (microsoft#1158)
1 parent d1c708c commit a2ab184

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pyrit/executor/attack/printer/markdown_printer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from datetime import datetime
66
from typing import List
77

8-
from IPython.display import Markdown, display
9-
108
from pyrit.executor.attack.printer.attack_result_printer import AttackResultPrinter
119
from pyrit.memory import CentralMemory
1210
from pyrit.models import AttackResult, Message, MessagePiece, Score
@@ -47,9 +45,11 @@ def _render_markdown(self, markdown_lines: List[str]) -> None:
4745

4846
if self._display_inline:
4947
try:
48+
from IPython.display import Markdown, display
49+
5050
display(Markdown(full_markdown))
5151
except (ImportError, NameError):
52-
# Fallback to print if not in Jupyter environment
52+
# Fallback to print if IPython is not available
5353
print(full_markdown)
5454
else:
5555
print(full_markdown)

0 commit comments

Comments
 (0)