jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.15k stars 950 forks source link

how to support widgets in notebook while connecting remote cluster by http client #3627

Open wyhhyw123 opened 1 year ago

wyhhyw123 commented 1 year ago

hello,i am looking for a way to use ipywidgets while in notebook connecting to remote spark cluster via sparkmagic and livy. In this scenario, notebook can be regarded as a web editor, all the code(string type) will be sent to remote cluster via http client and then send the exec result back to notebook. So, the code such as "import ipywidgets as widgets \n widgets.Dropdown(xxx)" will execute in remote spark cluster( could install any package here if needed), then i wanna to parse the http response from remote spark and display the widgets in local notebook.

Is there any method to achieve what i mentioned above? thanks~

wyhhyw123 commented 1 year ago

At first, i think remote cluster can using json to serialize a widget object and add it into response, but it raised "TypeError: Object of type Dropdown is not JSON serializable"