W
Wasp-lang4mo ago
NuMu

adding python apps

Hello. Love this saas template. A couple of questions, I'm technical (non dev) but a low/no coder in terms of dev projects..have several pyhton/langchain POC apps I would love to move to this 1. Is the code your own Wasp framework e.g proprietary or is there something similar to study 2. Is it technically feasible to somehow set this up for python apps. Asking as have several working apps using streamlit/chainlit as frontends and want to use this instead. Appreciate it will need coding.. 3. Same question as no2 but for langchain this time 4. Anyway to call an API as the backend app? Totally understand that these will need some coding...just checking it's technically feasible Thanks
7 Replies
martinsos
martinsos4mo ago
1. Wasp is our own framework, and it is open source! 2. Currently you can't use it for python -> maybe in the future, but that won't be soon! 3. Langchain -> there is langchain for JS, so you could use it in Wasp via JS. 4. You can all any API from Wasp app, either from its client or its server code. You can also expose your own API via server code that others can call.
NuMu
NuMu4mo ago
Hey thanks!! I’ve plenty of API and JS projects to experiment with! Will start going through your docs…and guides..they look pretty comprehensive What an awesome contribution you’ve all created!
martinsos
martinsos4mo ago
Awesome, thanks :)!
Joa
Joa4mo ago
Hey NuMu In order to achieve this, you simply need to serve python application alongside your Wasp app So, basically wrap your project in Flask or another API library, and then expose the methods you want to access from there - then use Wasp as a proxy:)
NuMu
NuMu3mo ago
Hey thanks..I get the high level logic but it’s a bit over my current dev knowledge! …if you feel like a slightly more detailed description that would be helpful thx
martinsos
martinsos3mo ago
There are two things you can do: 1. Write a python program that you will run as a childe process from your Wasp server/node code via (so from an action / query / job / api / whatever fits your use case). Check https://www.digitalocean.com/community/tutorials/how-to-launch-child-processes-in-node-js . How will you have it available? You might just add it to the files under src/, or might install it via pip in your Dockerfile, ... . I know this is still quite high level, but going into more details would take too much explaining. 2. Write a python program that you will deploy as a separate server, as @Joa mentioned. Flask is asmall framework that enables you to wrap you python code and serve it as a HTTP server, so you can then send HTTP requests from Wasp server code to it. If this is still too high-level, I advise using this info to looking it up further online. Maybe best is asking ChatGPT for advice, you can paste this convo and have it explain and answer your questions.
How To Launch Child Processes in Node.js | DigitalOcean
Since Node.js instances create a single process with a single thread, JavaScript operations that take a long time to run can sometimes block the execution of…
NuMu
NuMu3mo ago
Hey thanks. Will see what I can do.