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