Show More
@@ -61,7 +61,7 b' class CythonMagics(Magics):' | |||
|
61 | 61 | and returns the result. If the variables `a` and `b` are defined |
|
62 | 62 | in the user's namespace, here is a simple example that returns |
|
63 | 63 | their sum:: |
|
64 | ||
|
64 | ||
|
65 | 65 | %%cython_inline |
|
66 | 66 | return a+b |
|
67 | 67 | |
@@ -78,14 +78,14 b' class CythonMagics(Magics):' | |||
|
78 | 78 | The contents of the cell are written to a `.pyx` file in the current |
|
79 | 79 | working directory, which is then imported using `pyximport`. This |
|
80 | 80 | magic requires a module name to be passed:: |
|
81 | ||
|
81 | ||
|
82 | 82 | %%cython_pyximport modulename |
|
83 | 83 | def f(x): |
|
84 | 84 | return 2.0*x |
|
85 | 85 | |
|
86 |
The compiled module is then imported and all of its symbols are |
|
|
87 |
the user's namespace. For most purposes, we recommend |
|
|
88 | `%%cython` magic. | |
|
86 | The compiled module is then imported and all of its symbols are | |
|
87 | injected into the user's namespace. For most purposes, we recommend | |
|
88 | the usage of the `%%cython` magic. | |
|
89 | 89 | """ |
|
90 | 90 | module_name = line.strip() |
|
91 | 91 | if not module_name: |
@@ -108,35 +108,41 b' class CythonMagics(Magics):' | |||
|
108 | 108 | @magic_arguments.magic_arguments() |
|
109 | 109 | @magic_arguments.argument( |
|
110 | 110 | '-c', '--compile-args', action='append', default=[], |
|
111 |
help="Extra flags to pass to compiler via the `extra_compile_args` |
|
|
111 | help="Extra flags to pass to compiler via the `extra_compile_args` " | |
|
112 | "Extension flag (can be specified multiple times)." | |
|
112 | 113 | ) |
|
113 | 114 | @magic_arguments.argument( |
|
114 | 115 | '-la', '--link-args', action='append', default=[], |
|
115 |
help="Extra flags to pass to linker via the `extra_link_args` |
|
|
116 | help="Extra flags to pass to linker via the `extra_link_args` " | |
|
117 | "Extension flag (can be specified multiple times)." | |
|
116 | 118 | ) |
|
117 | 119 | @magic_arguments.argument( |
|
118 | 120 | '-l', '--lib', action='append', default=[], |
|
119 |
help="Add a library to link the extension against (can be specified |
|
|
121 | help="Add a library to link the extension against (can be specified " | |
|
122 | "multiple times)." | |
|
120 | 123 | ) |
|
121 | 124 | @magic_arguments.argument( |
|
122 | 125 | '-I', '--include', action='append', default=[], |
|
123 |
help="Add a path to the list of include directories (can be specified |
|
|
126 | help="Add a path to the list of include directories (can be specified " | |
|
127 | "multiple times)." | |
|
124 | 128 | ) |
|
125 | 129 | @magic_arguments.argument( |
|
126 | 130 | '-f', '--force', action='store_true', default=False, |
|
127 |
help="Force the compilation of the pyx module even if it hasn't |
|
|
131 | help="Force the compilation of the pyx module even if it hasn't " | |
|
132 | "changed" | |
|
128 | 133 | ) |
|
129 | 134 | @magic_arguments.argument( |
|
130 | 135 | '-a', '--annotate', action='store_true', default=False, |
|
131 |
help="Produce a colorized HTML version of the source. |
|
|
136 | help="Produce a colorized HTML version of the source. " | |
|
137 | "(Implies --force)." | |
|
132 | 138 | ) |
|
133 | 139 | @cell_magic |
|
134 | 140 | def cython(self, line, cell): |
|
135 | 141 | """Compile and import everything from a Cython code cell. |
|
136 | 142 | |
|
137 | 143 | The contents of the cell are written to a `.pyx` file in the |
|
138 |
directory `IPYTHONDIR/cython` using a filename with the hash of the |
|
|
139 | This file is then cythonized and compiled. The resulting module | |
|
144 | directory `IPYTHONDIR/cython` using a filename with the hash of the | |
|
145 | code. This file is then cythonized and compiled. The resulting module | |
|
140 | 146 | is imported and all of its symbols are injected into the user's |
|
141 | 147 | namespace. The usage is similar to that of `%%cython_pyximport` but |
|
142 | 148 | you don't have to pass a module name:: |
@@ -179,7 +185,7 b' class CythonMagics(Magics):' | |||
|
179 | 185 | ) |
|
180 | 186 | dist = Distribution() |
|
181 | 187 | config_files = dist.find_config_files() |
|
182 |
try: |
|
|
188 | try: | |
|
183 | 189 | config_files.remove('setup.cfg') |
|
184 | 190 | except ValueError: |
|
185 | 191 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now