Skip to content

Commit 09aaa0e

Browse files
lpozomartin-martinbzaczynski
authored
Update sample code for the article on the REPL (#703)
Co-authored-by: Martin Breuss <[email protected]> Co-authored-by: Bartosz Zaczyński <[email protected]>
1 parent 961f910 commit 09aaa0e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

python-repl/.pythonstartup_v1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from importlib import reload
2+
from pprint import pp
3+
4+
try:
5+
from rich import pretty, traceback
6+
except ModuleNotFoundError:
7+
pass
8+
else:
9+
pretty.install()
10+
traceback.install(show_locals=False)

python-repl/.pythonstartup_v2

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from importlib import reload
2+
from pprint import pp
3+
4+
try:
5+
from dataclasses import replace
6+
7+
from _colorize import ANSIColors, default_theme, set_theme
8+
except ImportError:
9+
pass
10+
else:
11+
theme = default_theme.copy_with(
12+
syntax=replace(
13+
default_theme.syntax,
14+
keyword=ANSIColors.BOLD_YELLOW,
15+
string=ANSIColors.INTENSE_BLUE,
16+
number=ANSIColors.RED,
17+
comment=ANSIColors.GREY,
18+
),
19+
)
20+
set_theme(theme)

0 commit comments

Comments
 (0)