Giter Site home page Giter Site logo

akernel's People

Contributors

davidbrochart avatar jtpio avatar kylebarron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

akernel's Issues

Error when send_message is called without buffers

Hi @davidbrochart!

It turns out that akernel actually solves the issue with the widget we are building. We can use await to call async methods on our widget and the akernel isn't blocked unlike the default one:

image

Do you think there is a chance of these changes being accepted into the default ipykernel?

Our widget calls self.send(msg) without passing buffers and we are hitting this error:
image

It works just fine if we use self.send(msg, buffers=[]) instead, but I think akernel should also handle buffers=None.

Actually, send_message in akernel has a mutable default list argument for buffers which is problematic. It should probably just have a check if buffers to is not None instead

Global issues

I'm curious how this interacts with global variables inside a function inside a cell, for example:

a = 1

def f():
    global a
    a = 5

f()
print(a)

This prints out 5 with the current ipykernel, which is what I would expect.

Use AST to transform code

Currently the code is made async by direct manipulation of the code string. This is not robust, we should use the ast module instead.

Wrap already defined variables with X()

Currently, an already defined variable a is not wrapped with ipyx.X(a), but kept as-is. It shouldn't be the case because then it means that y = a + 1 is not updated when a changes.
This implies that all variables must be accessed with their .v attribute, not only when they are in the RHS of an assignment.

Allow redefinition of reactive variable

Currently, with e.g. a reactive variable y defined as:

y = x + 1

One needs to delete it before redefining it, e.g.:

del y  # currently needed
y = x + 2

It should be automatically deleted when redefined.

How to access reactive dependencies for display and navigation?

How can I access the information about dependencies of akernel to use it for JupyterLab extensions?
What would be the right entry point for that?

Lets say I have a JupyterLab extension that is able to access a notebook cell model:

let notebook = __tryToGetNotebook(app);
    if(notebook){       
        let cellModels = notebook.model.cells   
        for(let cellIndex=0; cellIndex < cellModels.length; cellIndex++){
            let cellModel = cellModels.get(cellIndex);          
            let dependencies = __getDependencies(cellModel, notebook); //<= how to implement this?
        }
}

=> Is it possible to ask the cell for its dependencies? Or would I have to somehow directly communicate with akernel or ipyx?

Related:

Some possible use cases:

A. Show neighboring cell dependencies in a dependency view when focusing a distinct cell.
The corresponding terms in obsservablehq are "Visual Dataflow" and "Minimap":
https://observablehq.com/@observablehq/introducing-visual-dataflow

image

B. Generate a full dependency graph

Could look similar to

image

https://observablehq.com/@observablehq/notebook-visualizer

https://observablehq.com/@observablehq/notebook-visualizer-elk-edition

C. Generate editable flow chart from akernel notebook cells

Maybe combine akernel with a view of ipyspaghetti or node-red, so that a user gets an alternative GUI to edit the notebook cells in some sort of flow chart.

https://github.com/cphyc/ipyspaghetti

image

https://nodered.org

image

D. Navigate between dependent cells.

Similar to the navigation features in a code IDE, the dependency information could be used to

  • Jump to a cell where some input comes from
  • Show usages of some output and jump to it

https://www.jetbrains.com/help/pycharm/navigating-through-the-source-code.html#go_to_declaration

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.