@@ -350,6 +350,12 @@ def cython(self, line, cell):
350
350
This is syntactic sugar on the
351
351
:func:`~sage.misc.cython.cython_compile` function.
352
352
353
+ Note that there is also the ``%%cython`` cell magic provided by Cython,
354
+ which can be loaded with ``%load_ext cython``, see
355
+ `Cython documentation <https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#compiling-with-a-jupyter-notebook>`_
356
+ for more details.
357
+ The semantic is slightly different from the version provided by Sage.
358
+
353
359
INPUT:
354
360
355
361
- ``line`` -- parsed as keyword arguments. The allowed arguments are:
@@ -425,6 +431,36 @@ def cython(self, line, cell):
425
431
....: ''')
426
432
UsageError: argument --view-annotate: invalid choice: 'xx' (choose from 'none', 'auto', 'webbrowser', 'displayhtml')
427
433
434
+ Test ``--view-annotate=displayhtml`` (note that in a notebook environment
435
+ an inline HTML frame will be displayed)::
436
+
437
+ sage: # needs sage.misc.cython
438
+ sage: shell.run_cell('''
439
+ ....: %%cython --view-annotate=displayhtml
440
+ ....: print(1)
441
+ ....: ''')
442
+ 1
443
+ <IPython.core.display.HTML object>
444
+
445
+ Test ``--view-annotate=webbrowser``::
446
+
447
+ sage: # needs sage.misc.cython webbrowser
448
+ sage: shell.run_cell('''
449
+ ....: %%cython --view-annotate
450
+ ....: print(1)
451
+ ....: ''')
452
+ 1
453
+ sage: shell.run_cell('''
454
+ ....: %%cython --view-annotate=auto
455
+ ....: print(1)
456
+ ....: ''')
457
+ 1
458
+ sage: shell.run_cell('''
459
+ ....: %%cython --view-annotate=webbrowser
460
+ ....: print(1)
461
+ ....: ''')
462
+ 1
463
+
428
464
Test invalid quotes (see :mod:`sage.repl.interpreter` for explanation of the dummy line)::
429
465
430
466
sage: # needs sage.misc.cython
0 commit comments