Python-JS two-way communication #2
Replies: 1 comment
ChatGPT's feedbackI asked chatGPT to read the above and do to "Give me an overview of the architecture of such a system, breaking the work that needs to be done into tasks that you will describe and suggest some tools (and possibly design patterns) that can be used to complete them". Note that the answer should be taken with a grain of salt. Some of the suggestions are dubious, and I have not told it about py2http, http2py, and http2js, which we'll use for the middleware. Certainly! The document you provided outlines a vision for integrating JS components, particularly those written in ReactJS, into a Jupyter notebook environment, facilitating seamless communication between the front-end and back-end. Here's an overview of the architecture and the tasks involved: Architecture Overview:
Tasks Breakdown:
Conclusion:The envisioned system aims to bridge the gap between front-end and back-end development within a Jupyter notebook environment, promoting reusability and collaboration. By breaking down the architecture into specific tasks and leveraging appropriate tools and design patterns, the system can provide a seamless experience for both analysts and ML engineers. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We want to be able to take a "JS component" and use it from python, in a jupyter notebook.
By "JS component" I mean "some JS+HTML+CSS that defines an element, view, or full 'app' whose functionality can be reused in various places".
The idea is to be able to facilitate reuse between front-end dev and back-end dev
(in particular, analysts and ML engineers).
We'd like, for instance, an analyst working within a notebook to import a python interface
to some rich data-explorer component written in ReactJS, feed it what it needs (e.g. a data source/target),
and then use the component's features fully, enabling the work done in it to then be
used back in the notebook.
For example, saw we take a forced-directed graph or tsne viz tool that visualizes data, enabling us to view, filter and select data points.
We'd like our analysts to be able to provide their data, or point to a source where the data can be found,
and then once they find an select the data they want to work with, using the features of the tool,
be able to extract that data and get it into some python collection that they can then continue their analysis with.
Here's a proof-of-concept solution for the example described above, along with other instances of this class.
Use some persisted data store and a platform-independent format as the middleware for py and js communication.
We could already get far by automating the strategy above as much as possible:
Not obliging the user to set up the data store themselves or have to define the codecs
necessary to communicate to the data middleware (at least not for the most common data types an analyst might use),
or cache management (to not clutter storage with ad hoc data).
Perhaps this approach could be further extended to allow some in-memory data store to be used,
which would improve communication speed.
We'd like to be able to do this with any JS component, but only through a specific normalized interface.
That is, the automation of the PY-JS communication setup will be done only for very specific (but open-closed)
python and JS interfaces. To use a third-party JS component, we will need to wrap it into a facade that
is compliant with our normalized interface that we will rely on, and the python interface will be totally determined by this.
This facade needs to be open-closed though.
That is, it needs to be able to accomodate any "lines of communication" between python and the JS component.
Note: Some solutions work in some environments, and not in others.
Typically, I've seen some things work in my browser-based notebook (what is launched by
jupyter notebookin terminal), but not in VScode notebook.We don't want to target covering all environments, but at least browser-based and VScode, which should cover a lot of users.
All reactions