Show More
@@ -1,43 +1,43 b'' | |||||
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 | import IPython.utils.version as version |
|
19 | import IPython.utils.version as version | |
20 |
|
20 | |||
21 | try: |
|
21 | try: | |
22 | import Cython |
|
22 | import Cython | |
23 | except: |
|
23 | except: | |
24 | Cython = None |
|
24 | Cython = None | |
25 |
|
25 | |||
26 | try: |
|
26 | try: | |
27 | from Cython.Build.IpythonMagic import CythonMagics |
|
27 | from Cython.Build.IpythonMagic import CythonMagics | |
28 | except : |
|
28 | except : | |
29 | pass |
|
29 | pass | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | ## still load the magic in IPython 3.x, remove completely in future versions. |
|
32 | ## still load the magic in IPython 3.x, remove completely in future versions. | |
33 | def load_ipython_extension(ip): |
|
33 | def load_ipython_extension(ip): | |
34 | """Load the extension in IPython.""" |
|
34 | """Load the extension in IPython.""" | |
35 |
|
35 | |||
36 | print("""The Cython magic has been move to the Cython package, hence """) |
|
36 | print("""The Cython magic has been moved to the Cython package, hence """) | |
37 |
print("""`%load_ext cythonmagic` is deprecated; |
|
37 | print("""`%load_ext cythonmagic` is deprecated; please use `%load_ext Cython` instead.""") | |
38 |
|
38 | |||
39 | if Cython is None or not version.check_version(Cython.__version__, "0.21"): |
|
39 | if Cython is None or not version.check_version(Cython.__version__, "0.21"): | |
40 | print("You need Cython version >=0.21 to use the Cython magic") |
|
40 | print("You need Cython version >=0.21 to use the Cython magic") | |
41 | return |
|
41 | return | |
42 | print("""\nThough, because I am nice, I'll still try to load it for you this time.""") |
|
42 | print("""\nThough, because I am nice, I'll still try to load it for you this time.""") | |
43 | Cython.load_ipython_extension(ip) |
|
43 | Cython.load_ipython_extension(ip) |
General Comments 0
You need to be logged in to leave comments.
Login now