question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cythonmagic jupyterlab compatibility

See original GitHub issue

Due to jQuery not being defined in jupyterlab, the %%cython magic is unable to show interactive html when invoked inside jupyterlab. See also jupyterlab#2634.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tdamsmacommented, Mar 2, 2018

Ok, think I figured this out. The following works in a jupyterlab notebook:


from IPython.core.magic import Magics, magics_class, line_magic
from IPython.display import display, HTML
toggleDiv = """
this.nextElementSibling.style.display != 'block' ? 
this.nextElementSibling.style.display = 'block' : 
this.nextElementSibling.style.display = 'none'
"""

HTML(f"""
    <button onClick="{toggleDiv}">Click</button>
    <div style='display=none'>ok</div>""")

The workaround is inlining the toggleDiv in the html, and not using the scripttag. Come to think of it, isn’t this just as much of a security issue as allowing js scripts?

1reaction
scodercommented, Sep 19, 2017

I’d be happy to see a pull request by someone who understands (a bit) how jupyterlab wants these things to work. The code isn’t complex, it’s not using jQuery, and it’s right here:

https://github.com/cython/cython/blob/ac4cbf0265735979ea17cedf051652f8603b7034/Cython/Compiler/Annotate.py#L82-L88

Read more comments on GitHub >

github_iconTop Results From Across the Web

cythonmagic — IPython 2.4.2-maint documentation
cythonmagic¶. Magic command interface for interactive work with Cython. Note. The Cython package needs to be installed separately.
Read more >
jupyter/jupyter - Gitter
Hi there, did anybody has success with placing Jupyterlab on a docker ... I'm interested in extending the jupyter kernel launcher for compatibility...
Read more >
Jupyter Notebook Documentation - Read the Docs
1.9 Browser Compatibility. The Jupyter Notebook aims to support the latest versions of these browsers: • Chrome. • Safari. • Firefox.
Read more >
Why does Jupyter Notebook "forget" Cython from one cell to ...
Python 3.6.1 |Anaconda custom (x86_64)| (default, May 11 2017, 13:04:09) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)].
Read more >
Release notes — Anaconda documentation
... jupyter_server 1.13.5 -> 1.18.1; jupyterlab 3.3.2 -> 3.4.4 ... more flexible dependency pinning of numpy packages, giving wider ranges of compatibility.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found