-
Notifications
You must be signed in to change notification settings - Fork 4
Adding a Flask backend #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…lp me identify what routes to replace with the Flask alternative
…ven't implemented nay backend changes), also added backendpref store and structure
…eyboard shortcuts, currently working on modifying handleRun and handleContinue
… out what other data structures (like nodeRegistry and some of the python generation code) I need to convert
…out how to replicate the validateGraphBridge() functionality
…imply redirect pyodide execution requests to the web server!
…ons with localStorage
… -> Pyodide backend -> workers in order to avoid accessing localStorage from the level of the workers in the Pyodide backend
…he store, instead of the value being passed down! Also identified where the rror is thrown about a owrker not being initialized
… seem to have finished eval and exec. Trying to figure out how to run streaming with flask now
…nch 'origin' into flask-backend'
|
TODOS
|
|
@KDW1 good start, basic exec/eval works and the toggle UI is there. But there are some architectural issues preventing this from working properly. Worker imports stores: Flask inside PyodideBackend: Streaming broken: Minor: Suggestion: |
|
Thank you for the help Milan. I appreciate the direction. I'll be sure to work on a separate Flask Backend class in |
|
TODOS (After Review)
|
…-backend Updating flask-backend branch of my fork with the most recent changes to main in the original repository
…tion. Still need to implement basic streaming option and also work on removing the flask snippets that remain in worker.ts
… a separate Flask Backend class, now I just need to begin working on Flask streaming and removing the Flask code from worker.ts
…ng logic within a single api request and then stream the resulting data!
…is working out but I need to work on fetching those results
… single API request!
…rrently working on the chunk streaming issue
…responses can be streamed within the same chunk
…n works but the continuation function is off
…it properly runs and continues the stream. This is lightning fast now!
|
@KDW1 for switching the backends, I think it would make sense to do that via URL parameter |
|
Thank you @milanofthe, sounds good I will add the backend preference switching to check for the search query parameter. Also, I may need more time to finish this as I realized that I messed up the namespace on the backend. Right now, I'm trying to add session-specific namesapaces so that clients with different session will have different namespaces. Before, I don't know exactly how it worked but I modified a global variable in the |
…s currently an issue with the 'quit' and 'exit' and 'copyright' properties of the namespace since they aren't encapsulated in quotes sadly
… flask-backend
|
I just finished the functionality that allows Pyodide to be the default while Flask is switched to via a URL parameter
|

Added an alternative setting for the PathView application so that you can either use Pyodide web assembly or send client-side fetch requests to a Flask web server that has execution, evaluation, and traceback routes (the initialization code of the server borrows from the
init()function found inworker.ts.Major Changes:
backendPreferenceStorewhich is nearly identical in form tothemeStoresince it switches between two binary values. It is binded to 'Q' (arbitrarily so), and toggling it callsswitchBackend(preference : BackendPreference)frombackend.tsbackendPreferenceStoreis accessed frombackend.tsand passed in as an event parameter sent along with the "init" message posted to the worker. This sets the backendPreference for said workerworker.tsthat previously calledawait pyodide.runPythonAsync(...)now has a fetch request counterpart, such that the Flask backend route is shallow copy of what pyodide was doingCurrent issues:
Scope: 'NoneType' object is not iterablewhich comes from thegenerateStreamingStartCode()function inpythonHelpers.ts, specifically thefind_scopes()funciton