Skip to content

How to access reactive dependencies for display and navigation? #25

Open

Description

@stefaneidelloth

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

Activity

  1. davidbrochart commented on Oct 27, 2021

    @davidbrochart
    Owner

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

    In akernel, dependencies are not cell based but variable based. When you assign to a variable, it keeps track of the variables that are used on the right hand side.
    So indeed I think you would have to communicate with the variable, which is an ipyx.X object. I think some of the use cases you mentioned could become possible by implementing the functionality in ipyx as a widget. In particular, the dependency graph could be interesting.

  2. davidbrochart commented on Oct 29, 2021

    @davidbrochart
    Owner

    #28 adds support for DAG visualization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions