Show More
@@ -1,41 +1,43 | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | The cython magic has been integrated into Cython itself, |
|
4 | 4 | which is now released in version 0.21. |
|
5 | 5 | |
|
6 |
cf github ` |
|
|
6 | cf github `Cython` organisation, `Cython` repo, under the | |
|
7 | 7 | file `Cython/Build/IpythonMagic.py` |
|
8 | 8 | """ |
|
9 | 9 | #----------------------------------------------------------------------------- |
|
10 | 10 | # Copyright (C) 2010-2011, IPython Development Team. |
|
11 | 11 | # |
|
12 | 12 | # Distributed under the terms of the Modified BSD License. |
|
13 | 13 | # |
|
14 | 14 | # The full license is in the file COPYING.txt, distributed with this software. |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | from __future__ import print_function |
|
18 | 18 | |
|
19 | import IPython.utils.version as version | |
|
20 | ||
|
19 | 21 | try: |
|
20 | 22 | import Cython |
|
21 | 23 | except: |
|
22 | 24 | Cython = None |
|
23 | 25 | |
|
24 | 26 | try: |
|
25 | 27 | from Cython.Build.IpythonMagic import CythonMagics |
|
26 | 28 | except : |
|
27 | 29 | pass |
|
28 | 30 | |
|
29 | 31 | |
|
30 | 32 | ## still load the magic in IPython 3.x, remove completely in future versions. |
|
31 | 33 | def load_ipython_extension(ip): |
|
32 | 34 | """Load the extension in IPython.""" |
|
33 | 35 | |
|
34 | 36 | print("""The Cython magic has been move to the Cython package, hence """) |
|
35 | 37 | print("""`%load_ext cythonmagic` is deprecated; Please use `%load_ext Cython` instead.""") |
|
36 | 38 | |
|
37 |
if Cython is None or |
|
|
39 | if Cython is None or not version.check_version(Cython.__version__, "0.21"): | |
|
38 | 40 | print("You need Cython version >=0.21 to use the Cython magic") |
|
39 | 41 | return |
|
40 | 42 | print("""\nThough, because I am nice, I'll still try to load it for you this time.""") |
|
41 | 43 | Cython.load_ipython_extension(ip) |
@@ -1,7 +1,7 | |||
|
1 | 1 | .. _extensions_cythonmagic: |
|
2 | 2 | |
|
3 | 3 | =========== |
|
4 | 4 | cythonmagic |
|
5 | 5 | =========== |
|
6 | 6 | |
|
7 |
The `cython` magic has been moved in the ` |
|
|
7 | The `cython` magic has been moved in the `Cython` package. |
@@ -1,1 +1,1 | |||
|
1 | * The ``%cython`` magic, is now part of the Cython module. Use `%load_ext Cython` with a version of Cython >= 0.21 to have acces to the magic now. | |
|
1 | * The ``%cython`` magic, is now part of the Cython module. Use `%load_ext Cython` with a version of Cython >= 0.21 to have access to the magic now. |
General Comments 0
You need to be logged in to leave comments.
Login now