|
@@
-205,8
+205,8
b' This cleanup was the last major piece of deep refactoring needed from the'
|
|
205
|
205
|
original 2001 codebase.
|
|
206
|
206
|
|
|
207
|
207
|
We have also introduced a new type of magic function, prefixed with `%%`
|
|
208
|
|
instead of `%`, which operates at the cell level. A cell magic receives two
|
|
209
|
|
arguments: the line it is called on (like a line magic) and the body of the
|
|
|
208
|
instead of `%`, which operates at the whole-cell level. A cell magic receives
|
|
|
209
|
two arguments: the line it is called on (like a line magic) and the body of the
|
|
210
|
210
|
cell below it.
|
|
211
|
211
|
|
|
212
|
212
|
Cell magics are most natural in the notebook, but they also work in the
|
|
@@
-272,9
+272,62
b' This is what some of the script-related magics look like in action:'
|
|
272
|
272
|
In addition, we have also a number of :ref:`extensions <extensions_overview>`
|
|
273
|
273
|
that provide specialized magics. These typically require additional software
|
|
274
|
274
|
to run and must be manually loaded via ``%load_ext <extension name>``, but are
|
|
275
|
|
extremely useful. In particular, we want to highlight a few:
|
|
|
275
|
extremely useful. The following extensions are provided:
|
|
276
|
276
|
|
|
|
277
|
Cython magics (extension :ref:`octavemagic <extensions_cythonmagic>`)
|
|
|
278
|
This extension provides magics to automatically build and compile Python
|
|
|
279
|
extension modules using the Cython_ language. You must install Cython
|
|
|
280
|
separately, as well as a C compiler, for this to work. The examples
|
|
|
281
|
directory in the source distribution ships with a full notebook
|
|
|
282
|
demonstrating these capabilities:
|
|
277
|
283
|
|
|
|
284
|
.. image:: ../_static/ipy_013_notebook_cythonmagic.png
|
|
|
285
|
:width: 460px
|
|
|
286
|
:alt: Cython magic
|
|
|
287
|
:align: center
|
|
|
288
|
:target: ../_static/ipy_013_notebook_cythonmagic.png
|
|
|
289
|
|
|
|
290
|
.. _cython: http://cython.org
|
|
|
291
|
|
|
|
292
|
Octave magics (extension :ref:`octavemagic <extensions_octavemagic>`)
|
|
|
293
|
This extension provides several magics that support calling code written in
|
|
|
294
|
the Octave_ language for numerical computing. You can execute single-lines
|
|
|
295
|
or whole blocks of Octave code, capture both output and figures inline
|
|
|
296
|
(just like matplotlib plots), and have variables automatically converted
|
|
|
297
|
between the two languages. To use this extension, you must have Octave
|
|
|
298
|
installed as well as the oct2py_ and h5py_ packages. The examples
|
|
|
299
|
directory in the source distribution ships with a full notebook
|
|
|
300
|
demonstrating these capabilities:
|
|
|
301
|
|
|
|
302
|
.. image:: ../_static/ipy_013_notebook_octavemagic.png
|
|
|
303
|
:width: 460px
|
|
|
304
|
:alt: Octave magic
|
|
|
305
|
:align: center
|
|
|
306
|
:target: ../_static/ipy_013_notebook_octavemagic.png
|
|
|
307
|
|
|
|
308
|
.. _octave: http://www.gnu.org/software/octave
|
|
|
309
|
.. _oct2py: http://pypi.python.org/pypi/oct2py
|
|
|
310
|
.. _h5py: http://code.google.com/p/h5py
|
|
|
311
|
|
|
|
312
|
|
|
|
313
|
R magics (extension :ref:`rmagic <extensions_rmagic>`)
|
|
|
314
|
This extension provides several magics that support calling code written in
|
|
|
315
|
the R_ language for statistical data analysis. You can execute
|
|
|
316
|
single-lines or whole blocks of R code, capture both output and figures
|
|
|
317
|
inline (just like matplotlib plots), and have variables automatically
|
|
|
318
|
converted between the two languages. To use this extension, you must have
|
|
|
319
|
R installed as well as the rpy2_ package that bridges Python and R. The
|
|
|
320
|
examples directory in the source distribution ships with a full notebook
|
|
|
321
|
demonstrating these capabilities:
|
|
|
322
|
|
|
|
323
|
.. image:: ../_static/ipy_013_notebook_rmagic.png
|
|
|
324
|
:width: 460px
|
|
|
325
|
:alt: R magic
|
|
|
326
|
:align: center
|
|
|
327
|
:target: ../_static/ipy_013_notebook_rmagic.png
|
|
|
328
|
|
|
|
329
|
.. _R: http://www.r-project.org
|
|
|
330
|
.. _rpy2: http://rpy.sourceforge.net/rpy2.html
|
|
278
|
331
|
|
|
279
|
332
|
|
|
280
|
333
|
Tab completer improvements
|