Skip to content

Commit d43533f

Browse files
committed
Setup debugger: debugpy
1 parent 3d6cc57 commit d43533f

File tree

6 files changed

+585
-29
lines changed

6 files changed

+585
-29
lines changed

.vscode/launch.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Attach to EPY",
5+
"type": "python",
6+
"request": "attach",
7+
"connect": {
8+
"host": "localhost",
9+
"port": 5678
10+
}
11+
}
12+
]
13+
}

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.PHONY: tests
22
.DEFAULT_GOAL := tests
33

4+
debug:
5+
python -m debugpy --listen 5678 --wait-for-client -m epy
6+
47
dev:
58
poetry install
69

epy.py

+1-23
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424

2525

26-
__version__ = "2022.4.18"
26+
__version__ = "2022.9.24"
2727
__license__ = "GPL-3.0"
2828
__author__ = "Benawi Adha"
2929
__email__ = "[email protected]"
@@ -82,26 +82,7 @@
8282
try:
8383
# Debug swith
8484
# $ DEBUG=1 ./epy.py
85-
8685
DEBUG = int(str(os.getenv("DEBUG"))) == 1
87-
STDSCR = None
88-
89-
def debug(context: int = 5) -> None:
90-
# if not isinstance(STDSCR, curses.window):
91-
# raise RuntimeError("STDSCR not set")
92-
if STDSCR:
93-
curses.nocbreak()
94-
STDSCR.keypad(False) # type: ignore
95-
curses.echo()
96-
curses.endwin()
97-
98-
try:
99-
import ipdb # type: ignore
100-
101-
ipdb.set_trace(context=context)
102-
except ModuleNotFoundError:
103-
breakpoint()
104-
10586
except ValueError:
10687
DEBUG = False
10788

@@ -3853,9 +3834,6 @@ def read(self, reading_state: ReadingState) -> Union[ReadingState, Ebook]:
38533834

38543835

38553836
def preread(stdscr, filepath: str):
3856-
global STDSCR
3857-
if DEBUG:
3858-
STDSCR = stdscr
38593837

38603838
ebook = get_ebook_obj(filepath)
38613839
state = State()

0 commit comments

Comments
 (0)