-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add a -q parameter to %rerun magic #11671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
IPython/core/magics/history.py
Outdated
@@ -289,8 +289,10 @@ def rerun(self, parameter_s=''): | |||
current command. | |||
|
|||
-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.