##// END OF EJS Templates
DEV: Allow supplying jinja vars from python config.
DEV: Allow supplying jinja vars from python config.

File last commit:

r20736:dfee7e1c
r21009:ca553ec3
Show More
cythonmagic.py
43 lines | 1.4 KiB | text/x-python | PythonLexer
Brian Granger
Adding Cython extension and example notebook.
r7031 # -*- coding: utf-8 -*-
"""
Matthias Bussonnier
remove cython extension....
r17910 The cython magic has been integrated into Cython itself,
which is now released in version 0.21.
Bradley M. Froehle
Add %%cython magics to generated documentation.
r8893
Matthias Bussonnier
Fix version string comparison, capitalisation and typos.
r18302 cf github `Cython` organisation, `Cython` repo, under the
Matthias Bussonnier
remove cython extension....
r17910 file `Cython/Build/IpythonMagic.py`
Brian Granger
Adding Cython extension and example notebook.
r7031 """
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011, IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
Bradley M. Froehle
Print message on stderr if annotated html cannot be read.
r8095 from __future__ import print_function
Matthias Bussonnier
Fix version string comparison, capitalisation and typos.
r18302 import IPython.utils.version as version
Brian Granger
Adding Cython extension and example notebook.
r7031 try:
Matthias Bussonnier
remove cython extension....
r17910 import Cython
except:
Cython = None
MinRK
py3 workaround for reload in cythonmagic...
r9894
try:
Matthias Bussonnier
remove cython extension....
r17910 from Cython.Build.IpythonMagic import CythonMagics
except :
pass
Brian Granger
Adding docstrings to the cython magics.
r7037
Brian Granger
Adding Cython extension and example notebook.
r7031
Matthias Bussonnier
remove cython extension....
r17910 ## still load the magic in IPython 3.x, remove completely in future versions.
Brian Granger
Adding Cython extension and example notebook.
r7031 def load_ipython_extension(ip):
"""Load the extension in IPython."""
Matthias Bussonnier
remove cython extension....
r17910
Giuseppe Venturini
Fix typo...
r20736 print("""The Cython magic has been moved to the Cython package, hence """)
print("""`%load_ext cythonmagic` is deprecated; please use `%load_ext Cython` instead.""")
Matthias Bussonnier
remove cython extension....
r17910
Matthias Bussonnier
Fix version string comparison, capitalisation and typos.
r18302 if Cython is None or not version.check_version(Cython.__version__, "0.21"):
Matthias Bussonnier
remove cython extension....
r17910 print("You need Cython version >=0.21 to use the Cython magic")
return
Matthias Bussonnier
use Cython.load_ipython_ext to simplify
r17914 print("""\nThough, because I am nice, I'll still try to load it for you this time.""")
Cython.load_ipython_extension(ip)