-
Notifications
You must be signed in to change notification settings - Fork 0
/
debugging_python.tex
291 lines (234 loc) · 7.41 KB
/
debugging_python.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
% Python debugging
% by Roman gryf Dobosz 2015
\documentclass[14pt,notes,svgnames]{beamer}
% \documentclass[14pt,notes,svgnames,aspectratio=1610]{beamer}
% \documentclass[14pt,notes,svgnames,aspectratio=169]{beamer}
\usecolortheme{seagull}
\usecolortheme[RGB={23,57,107}]{structure}
\usenavigationsymbolstemplate{} % Gets rid of slide navigation symbols
\usefonttheme{professionalfonts} % using non standard fonts for beamer
% for proper underline
\usepackage[normalem]{ulem}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
% color and font customization
\definecolor{ExecusharesEmph}{RGB}{20,57,107}
\definecolor{ExecusharesBlack}{RGB}{47,42,42}
\definecolor{ExecusharesWhite}{RGB}{211,205,193}
\definecolor{ExecusharesGrey}{RGB}{96,83,58}
\setmainfont{DejaVu Sans}
\setsansfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}
\setbeamercolor{itemize item}{fg=ExecusharesEmph}
\setbeamercolor{enumerate item}{fg=ExecusharesEmph}
\setbeamercolor{alerted text}{fg=ExecusharesEmph}
\setbeamercolor{section in toc}{fg=ExecusharesBlack}
\setbeamercolor{background canvas}{bg=ExecusharesWhite}
\setbeamercolor{normal text}{fg=ExecusharesEmph}
\setbeamerfont{author}{size*={14}{1.4em}}
\setbeamerfont{date}{size*={7}{0.7em}}
\useinnertheme{circles}
\usepackage{graphicx}
% \usepackage{sidecap}
% \usepackage{hyperref}
\usepackage{listings}
\definecolor{ListingsKeywords}{RGB}{107,81,42}
\definecolor{ListingsComments}{RGB}{20,56,107}
\definecolor{ListingsStrings}{RGB}{90,20,107}
\definecolor{ListingsIdentifiers}{RGB}{39,107,20}
\lstset{language=Python,
basicstyle=\ttfamily\small,
keywordstyle=\color{ListingsKeywords},
commentstyle=\color{ListingsComments},
stringstyle=\color{ListingsStrings},
showstringspaces=false,
identifierstyle=\color{ListingsIdentifiers}
}
\setbeamerfont{framesubtitle}{family=\fontfamily{hvt}\selectfont}
\setbeamerfont{frametitle}{series=\bfseries}
\setbeamertemplate{frametitle}{%
\begin{centering}
\textbf{\insertframetitle}
\par
\end{centering}
}
\setbeamertemplate{custom section}
{%
\begin{centering}
\usebeamerfont{section title}
\Large\bfseries
{\color{ExecusharesWhite}\insertsection\par}
\end{centering}
}
\def\sectionpage{\usebeamertemplate*{custom section}}
\defbeamertemplate*{title page}{customized}[1][]
{%
\center
\usebeamerfont{title}\inserttitle\par
\bigskip
{\color{ExecusharesEmph} \usebeamerfont{author}\insertauthor\par}
\usebeamerfont{institute}\insertinstitute\par
\bigskip
\usebeamerfont{date}\insertdate\par
}
\AtBeginSection{\frame{\sectionpage}}
\begin{document}
\title{%
\includegraphics[width=7cm]{images/title.pdf}
}
\author{Roman Dobosz}
\date{PyGDA, 29 June, 2015}
\begin{frame}
\titlepage
\end{frame}
\begingroup
\setbeamercolor{background canvas}{bg=ExecusharesBlack}
\section{Agenda}
\endgroup
\begin{frame}
\begin{columns}
\column{.5\textwidth}
\begin{itemize}[<+->]
\item<1,2,3> Failure detection
\item<2,3> Python debuggers
\item<3> \lstinline{pdb} in practice
\end{itemize}
\column{.4\textwidth}
\centering
\only<1>{\includegraphics[width=3cm]{images/find_bug.png}}
\only<2>{\includegraphics[width=3cm]{images/debugs.png}}
\only<3>{\includegraphics[width=3cm]{images/pdb.png}}
\end{columns}
\end{frame}
\begingroup
\setbeamercolor{background canvas}{bg=ExecusharesBlack}
\section{How to find the place of a failure}
\endgroup
\begin{frame}
\begin{columns}
\column{.5\textwidth}
\begin{itemize}[<+->]
\item<1,2,3,4,5> traceback (obviously)
\item<2,3,4,5> \lstinline{print} statement
\item<3,4,5> module \lstinline{logging}
\item<4,5> module \lstinline{trace}
\item<5> debugger
\end{itemize}
\column{.4\textwidth}
\centering
\only<1>{%
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{images/traceback.png}
}
\only<2>{%
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{images/print.png}
}
\only<3>{%
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{images/logging.png}
}
\only<4>{%
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{images/trace.png}
}
\only<5>{%
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{images/pudb.png}
}
\end{columns}
\end{frame}
\begingroup
\setbeamercolor{background canvas}{bg=ExecusharesBlack}
\section{Python debuggers}
\endgroup
\begin{frame}
Debuggers can be divided in several different aspects
\begin{columns}
\column{.5\textwidth}
\begin{itemize}[<+->]
\item<1,2,3> Text based
\item<2,3> Graphical
\item<3> Embedded in IDE
\end{itemize}
\column{.4\textwidth}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Debuggers - text based}
\begin{columns}
\column{.5\textwidth}
\begin{itemize}
\item \lstinline{pdb}
\item \lstinline{ipdb}
\item \lstinline{pdb++}
\item \lstinline{pudb}
\item \color{blue}\href{https://wiki.python.org/moin/PythonDebuggingTools}{\uline{others}}
\end{itemize}
\column{.4\textwidth}
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{"images/ipdb.png"}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Debuggers - graphical}
\begin{columns}
\column{.5\textwidth}
\begin{itemize}
\item Winpdb
\item \lstinline{pywin.debugger}
\end{itemize}
\column{.4\textwidth}
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{"images/winpdb.png"}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Debuggers - IDE}
\begin{columns}
\column{.5\textwidth}
\begin{itemize}
\item PyCharm
\item PyDev (Eclipse)
\item Wings IDE
\item Visual Studio
\item \color{blue}\href{https://wiki.python.org/moin/IntegratedDevelopmentEnvironments}{\uline{others!}}
\end{itemize}
\column{.4\textwidth}
\vspace*{0cm}
\hspace*{0cm}\includegraphics[width=5cm]{"images/pycharm.png"}
\end{columns}
\end{frame}
\begingroup
\setbeamercolor{background canvas}{bg=ExecusharesBlack}
\section{Python debugger - pdb}
\endgroup
\begin{frame}
\frametitle{cm2inch.py}
\begin{itemize}
\item Problem: Convert length in centimetre into inch and vice versa
\item Solution: Simple TKinter program to do this
\pause
\item …But it doesn't work :(
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{cm2inch.py - structure}
\begin{itemize}
\item Single class defined - \lstinline{CmInchConverter}
\item Method \lstinline{run} launches the program
\item Method \lstinline{_gui_initialze} builds the GUI
\item Method \lstinline{calculate} implements the actual calculation logic
\end{itemize}
\end{frame}
\begin{frame}
\centerline{\Large Let see it in action!}
\end{frame}
\begingroup
\setbeamercolor{background canvas}{bg=ExecusharesBlack}
\section{Questions?}
\endgroup
\begin{frame}
\centerline{\Large Thank you!}
\end{frame}
\end{document}