rete icon indicating copy to clipboard operation
rete copied to clipboard

python api?

Open andreaBelmont opened this issue 4 years ago • 5 comments

Hello, do you have or do you know of any python apis to your project?

andreaBelmont avatar Jul 09 '20 16:07 andreaBelmont

@andreaBelmont have you seen this: https://github.com/zebulon75018/flaskretejs?

creadicted avatar Jul 09 '20 18:07 creadicted

@creadicted what that repo did is nothing but exposed an api to save/load a text file, but meanwhile did not use the api at all... so i think it is irrelevant

dumasss163 avatar Nov 18 '20 06:11 dumasss163

I want this to be a thing. How would the execution model work for this?

How about this:

  • A python module factory exists to create RETE components for each python module. This is instantiated in Rete.js
  • The factory communicates with a python server. A python server returns a list of ALL python objects that will work with RETE.js.
  • The factory creates as many components as there are python objects reported by that server.
  • A rete component is basically a composed wrapper to make calls to instantiated objects on the python server.
  • The python server registers its workers by reading a target directory full of classes that all inherit the same structure.
  • Execution happens on the python server and is called by rete.js wrapper commponents.

Does this sound like a good way forward?

isConic avatar Mar 24 '21 16:03 isConic

I'm not sure I understand exactly, but please check out pyodide. You get python in the browser without a server.

https://pyodide.org/en/stable/using_pyodide_from_javascript.html

unhott avatar Mar 24 '21 16:03 unhott

There are some limitations and nuances I have not been able to explore. But, some neat things that can be used:

In the basic example, you can open the js console. run the following

  pyodide.runPythonAsync('import micropip')
  pyodide.runPythonAsync('micropip.install("pandas")')
  pyodide.runPythonAsync('import pandas as pd')
  
  pyodide.globals.pd
  pyodide.globals.pd.__version__

unhott avatar Mar 24 '21 16:03 unhott

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]