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.

Provide a single executable cell

See original GitHub issue

Hi dear jupyterians,

I’m a french teacher and I really like this project because it’s quite difficult for students to install python on their own machines.

First of all the full notebook frontend would be very useful for practicing on projects.

But sometimes we just need a single cell to show a quick example or ask a question. Is there’s any component in the jupyterstack that could be ported as something as simple as a web component as it is done on wc-component.

https://github.com/vanillawc/wc-code

Thanks for sharing this as an open source project.

Problem

Proposed Solution

Additional context

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:19 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
jtpiocommented, Feb 3, 2022

FYI I have recently been iterating on REPLite (https://github.com/jtpio/replite) to provide a minimal code console that is easy to embed on other websites with:

<iframe src="https://replite.vercel.app/retro/consoles?toolbar=1&kernel=python&code=import numpy as np" width="100%" height="100%">
</iframe>

The motivation was to make it easier it to try numpy in the browser on numpy.org: https://github.com/numpy/numpy.org/pull/547

image

For now it’s just the RetroLab console page (/retro/consoles) with custom CSS and plugins to read options for the URL query arguments.

Ideally there should be a more generic way for building small lab and lite remixes from scratch with less effort (https://github.com/jupyterlab/jupyterlab/pull/11693). Or we ship a new cell app as mentioned above once #118 is fixed.

3reactions
bollwyvlcommented, Jun 17, 2021

Right. It’s a good goal. Once we have #118 squared away, we’ll be able to do all kinds of custom apps (without substantially over-inflating the final archive (or having to do multiple releases), with a file tree more like:

app/
  index.html    # will redirect to... something
  static/       # where all the build stuff will end up
  lab/         
    index.html  # won't be required
    extensions/
  retro/
    index.html
  editor/
    index.html
  cell/
    index.html
  term/
    index.html
  book/
    index.html  # will need lots of work!
  # .../        # basically anything from https://github.com/jupyterlab/jupyterlab/tree/master/examples

As for integration of that cell: I anticipate the initial approach being an iframe with a (documented) URL param mini-language as the most-broadly integrateable solution.

<body>
  <h1>run some code</h1>
 <iframe src="./_static/cell/index.html?p=foo.ipynb&d=Notebook&m=io" />
</body>

We can emit a few things over postMessage (with a schema) but generally won’t have access to the outer scope, and would rely on the source documents being in _static/files, but wouldn’t need them indexed.

Anyhow, maybe something like a mockup

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make your code cells executable - Jupyter Book
This provides you with a Live Code button that, when clicked, will convert each code cell into an interactive cell that can be...
Read more >
How to make a Single Executable VS 2010 - Stack Overflow
If VS2010 is anything like VS2008, you need to go to project properties/c++/code generation and select a static runtime library.
Read more >
Executable models of pathways built using single-cell...
Executable models of pathways built using single - cell RNAseq data reveal immune cell heterogeneity in people living with HIV and ...
Read more >
Synthesising Executable Gene Regulatory Networks from ...
These single-cell measurements provide snapshots of the states of the cells that make up a tissue, instead of the population-level averages ...
Read more >
Working with Jupyter code cells in the Python Interactive window
Jupyter (formerly IPython Notebook) is an open-source project that lets you easily combine Markdown text and executable Python source code on one canvas ......
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