diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2014-03-07 10:13:07 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2014-03-07 10:13:07 +0100 |
commit | 7553d6d68f0642a57ae812c3804aa7e075062fb2 (patch) | |
tree | 691dfb75f2438224734c19d2a7a131c594aed752 | |
parent | 3d6f0126b8381f9b4e790bab813f5681d75f6787 (diff) | |
download | cython-7553d6d68f0642a57ae812c3804aa7e075062fb2.tar.gz |
add doc note on how to use Cython from IPython notebook
-rw-r--r-- | docs/src/quickstart/build.rst | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/src/quickstart/build.rst b/docs/src/quickstart/build.rst index 5229a1228..f71b1b7f9 100644 --- a/docs/src/quickstart/build.rst +++ b/docs/src/quickstart/build.rst @@ -46,6 +46,38 @@ start a Python session and do ``from hello import say_hello_to`` and use the imported function as you see fit. +Using the IPython notebook +-------------------------- + +Cython can be used conveniently and interactively from a web browser +through the IPython notebook. To install IPython, e.g. into a virtualenv, +use pip: + +.. sourcecode:: bash + + (venv)$ pip install "ipython[notebook]" + (venv)$ ipython notebook + +To enable support for Cython compilation, install Cython and load the +``cythonmagic`` extension from within IPython:: + + %load_ext cythonmagic + +Then, prefix a cell with the ``%%cython`` marker to compile it:: + + %%cython + + cdef int a = 0 + for i in range(10): + a += i + print a + +You can show Cython's code analysis by passing the ``--annotate`` option:: + + %%cython --annotate + ... + + Using the Sage notebook ----------------------- |