From e81786e26fd0c53a6c4ae3f921e582e2802cf5d8 2021-11-12 23:59:40 From: Matthias Bussonnier Date: 2021-11-12 23:59:40 Subject: [PATCH] Backport PR #13267: Document that `%run` can execute notebooks and ipy scripts. --- diff --git a/IPython/core/magics/execution.py b/IPython/core/magics/execution.py index 940b69f..6b65193 100644 --- a/IPython/core/magics/execution.py +++ b/IPython/core/magics/execution.py @@ -532,7 +532,18 @@ python-profiler package from non-free.""") %run [-n -i -e -G] [( -t [-N] | -d [-b] | -p [profile options] )] - ( -m mod | file ) [args] + ( -m mod | filename ) [args] + + The filename argument should be either a pure Python script (with + extension ``.py``), or a file with custom IPython syntax (such as + magics). If the latter, the file can be either a script with ``.ipy`` + extension, or a Jupyter notebook with ``.ipynb`` extension. When running + a Jupyter notebook, the output from print statements and other + displayed objects will appear in the terminal (even matplotlib figures + will open, if a terminal-compliant backend is being used). Note that, + at the system command line, the ``jupyter run`` command offers similar + functionality for executing notebooks (albeit currently with some + differences in supported options). Parameters after the filename are passed as command-line arguments to the program (put in sys.argv). Then, control returns to IPython's