Coder Social home page Coder Social logo

Comments (4)

kafonek avatar kafonek commented on June 19, 2024

@opoloko thanks for flagging this, I haven't done any extensive testing with JupyterLab or VSCode. After a bit of cursory fiddling this evening, I'm leaning towards the issue being with magic commands (%block, %blockrun) working differently in JupyterLab / VSCode versus classic Notebook.

I was able to get this minimal example to work with expected behavior in Jupyterlab:

### cell 1
import ipywidgets as widgets

dropdown = widgets.Dropdown(options=['', 'foo', 'bar', 'baz'])
dropdown

### cell 2
import ipython_blocking
ctx = ipython_blocking.CaptureExecution()
with ctx:     
    while True:
        if dropdown.value:
            break
        ctx.step()

### cell 3
print("just a string to demonstrate blocking until dropdown changes")

### cell 4
print(dropdown.value)

After a cell -> run all, cells 3 and 4 didn't execute until after I chose an option in the dropdown widget.

I haven't spent a lot of time looking at IPython magic commands outside of classic Notebook. If you have any leads on the differences between classic vs Lab/VSCode, I'd appreciate pointers. Thanks.

from ipython_blocking.

bryceschober avatar bryceschober commented on June 19, 2024

Me too, FWIW...

from ipython_blocking.

kafonek avatar kafonek commented on June 19, 2024

@bryceschober I'm afraid I'm having trouble replicating these errors. I just ran the 4-cell example code in both a VSCode (centos7 / python 3.6 / VSCode Python extension) and JupyterLab (Lab 2.2.5, using docker-stacks image, installed @jupyter-widgets from extension manager).

Can you give any more details about system or versions that aren't working for you? Thanks.

from ipython_blocking.

bryceschober avatar bryceschober commented on June 19, 2024

@kafonek Hey, I guess you're right. I must have been doing something else wrong, because I switched a separate notebook to %block dropdown and it does work... You can go ahead and close this case.

from ipython_blocking.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.