From d5b7de909aa3a5b395aa76f6b3c5f83c8d0b5a26 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 3 Dec 2020 12:25:42 +1100 Subject: [PATCH 1/3] Revert "migrate code-block to literal with syntax highlighting (#106)" This reverts commit 58770817961938ddff4a4cfaee9e6f50d2985f19. --- lectures/debugging.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lectures/debugging.md b/lectures/debugging.md index c3822a34..162d4720 100644 --- a/lectures/debugging.md +++ b/lectures/debugging.md @@ -121,13 +121,13 @@ plot_log() # Call the function, generate plot But this time we type in the following cell block -```ipython +```{code-block} ipython %debug ``` You should be dropped into a new prompt that looks something like this -```ipython +```{code-block} ipython ipdb> ``` @@ -138,7 +138,7 @@ Now we can investigate the value of our variables at this point in the program, For example, here we simply type the name `ax` to see what's happening with this object: -```ipython +```{code-block} ipython ipdb> ax array([, ], dtype=object) @@ -150,7 +150,7 @@ problem. To find out what else you can do from inside `ipdb` (or `pdb`), use the online help -```ipython +```{code-block} ipython ipdb> h Documented commands (type help ): @@ -203,7 +203,7 @@ To investigate, it would be helpful if we could inspect variables like `x` durin To this end, we add a "break point" by inserting `breakpoint()` inside the function code block -```python3 +```{code-block} python3 def plot_log(): breakpoint() fig, ax = plt.subplots() @@ -216,7 +216,7 @@ plot_log() Now let's run the script, and investigate via the debugger -```ipython +```{code-block} ipython > (6)plot_log() -> fig, ax = plt.subplots() (Pdb) n From 51a90586b7c78ec9acb1bd79f5d197536a475ba3 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 3 Dec 2020 12:28:52 +1100 Subject: [PATCH 2/3] add no-execute tags for sphinx-tojupyter --- lectures/debugging.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lectures/debugging.md b/lectures/debugging.md index 162d4720..03dbd8d4 100644 --- a/lectures/debugging.md +++ b/lectures/debugging.md @@ -122,12 +122,14 @@ plot_log() # Call the function, generate plot But this time we type in the following cell block ```{code-block} ipython +:no-execute: %debug ``` You should be dropped into a new prompt that looks something like this ```{code-block} ipython +:no-execute: ipdb> ``` @@ -139,6 +141,7 @@ For example, here we simply type the name `ax` to see what's happening with this object: ```{code-block} ipython +:no-execute: ipdb> ax array([, ], dtype=object) @@ -151,6 +154,7 @@ To find out what else you can do from inside `ipdb` (or `pdb`), use the online help ```{code-block} ipython +:no-execute: ipdb> h Documented commands (type help ): @@ -204,6 +208,7 @@ To investigate, it would be helpful if we could inspect variables like `x` durin To this end, we add a "break point" by inserting `breakpoint()` inside the function code block ```{code-block} python3 +:no-execute: def plot_log(): breakpoint() fig, ax = plt.subplots() @@ -217,6 +222,7 @@ plot_log() Now let's run the script, and investigate via the debugger ```{code-block} ipython +:no-execute: > (6)plot_log() -> fig, ax = plt.subplots() (Pdb) n From 549cac81432b40a45454ae29a46d62effbfa91c4 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 3 Dec 2020 14:31:03 +1100 Subject: [PATCH 3/3] use class tags --- lectures/debugging.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lectures/debugging.md b/lectures/debugging.md index 03dbd8d4..431e0b8c 100644 --- a/lectures/debugging.md +++ b/lectures/debugging.md @@ -122,14 +122,14 @@ plot_log() # Call the function, generate plot But this time we type in the following cell block ```{code-block} ipython -:no-execute: +:class: no-execute %debug ``` You should be dropped into a new prompt that looks something like this ```{code-block} ipython -:no-execute: +:class: no-execute ipdb> ``` @@ -141,7 +141,7 @@ For example, here we simply type the name `ax` to see what's happening with this object: ```{code-block} ipython -:no-execute: +:class: no-execute ipdb> ax array([, ], dtype=object) @@ -154,7 +154,7 @@ To find out what else you can do from inside `ipdb` (or `pdb`), use the online help ```{code-block} ipython -:no-execute: +:class: no-execute ipdb> h Documented commands (type help ): @@ -208,7 +208,7 @@ To investigate, it would be helpful if we could inspect variables like `x` durin To this end, we add a "break point" by inserting `breakpoint()` inside the function code block ```{code-block} python3 -:no-execute: +:class: no-execute def plot_log(): breakpoint() fig, ax = plt.subplots() @@ -222,7 +222,7 @@ plot_log() Now let's run the script, and investigate via the debugger ```{code-block} ipython -:no-execute: +:class: no-execute > (6)plot_log() -> fig, ax = plt.subplots() (Pdb) n