Add a -q parameter to %rerun magic#11671
Conversation
IPython/core/magics/history.py
Outdated
|
|
||
| -g foo : Repeat the most recent line which contains foo | ||
|
|
||
| -q : Quiet mode: do not echo the cell contents back |
There was a problem hiding this comment.
I like this change, but could you make it clearer in the help docs that quiet means to suppress the history lines specifically? A user will still see any output from the command, right? "Quiet" usually implies that all regular output will be suppressed (i.e. non-errors) or maybe just lower verbosity.
There was a problem hiding this comment.
Documentation tone can often be the hardest part of a contribution. I've reworded this, but let me know if it's still not quite right, or feel free to specify wording yourself if you'd like.
| with capture_output() as cap: | ||
| ip.run_cell("%rerun -q", store_history=True) | ||
| nt.assert_equal(ip.user_ns["a"], 12) | ||
| nt.assert_not_in("a += 1", cap.stdout) |
There was a problem hiding this comment.
Thanks, nice work on the support functions like capture_output! ;)
a9723f3 to
8ab8cf5
Compare
This allows the rerun magic to be run in quiet mode, which suppresses the `=== Executing: ===` and `=== Output: ===` headings as well as the text of the cell being re-run. This means that cells that print can optionally be re-run as part of a larger control structure like a loop without IPython-specific noise.
8ab8cf5 to
6b663c0
Compare
|
I'm struggling to fix the sphinx build issue on Py3.7 here. I can't seem to build the docs locally, but I tried adding a newline to the options section as the output suggested to no effect. |
This allows the rerun magic to be run in quiet mode, which suppresses
the
=== Executing: ===and=== Output: ===headings as well as thetext of the cell being re-run. This means that cells that print can
optionally be re-run as part of a larger control structure like a loop
without IPython-specific noise.