Back

Appwrite uploaded function scope.

  • 0
  • Functions
Camo
7 Mar, 2023, 17:00

Where exactly is the runtime located for the functions? Are they scoped in a container or how does this work? I want to write a python function that uses external libraries, which are pretty big, so i want to understand where I would install them? Same goes for js functions, I'm curious on how this works, if anyone could explain, would be awesome. #python #js <#812714347298160690>

TL;DR
I want to understand how the runtime works for appwrite functions. Can I run external libraries and where would I install them?
Bouahaza
7 Mar, 2023, 17:54
Camo
7 Mar, 2023, 18:23

Thank you @Bouahaza, its nice to see that many run-times are supported, but that doesn't really answer my question. Lets say i would want to run playwright but i need to install browsers there as well. How would I do that? requirements.txt could solve the first part, of installing the pip package. What about installing the actual browsers? here's sample install code on ubuntu. py pip install pytest-playwright playwright install-deps playwright install Hope that makes sense.

rafagazani
7 Mar, 2023, 18:36

I use functions in python in my project. I just need to put the packeage in the requirements.txt file, appwrite is in charge of downloading the dependencies. One limitation I found, it is not possible to use pandas: https://github.com/appwrite/appwrite/issues/1037

Camo
7 Mar, 2023, 18:48

@rafagazani your github issue is a great example, of the problem I'm facing. Slight change is that i need playwright commands to be executed as well, not only install requirements.txt.

rafagazani
7 Mar, 2023, 18:53

I don't understand you, could you give an example of what you want to do?

Drake
7 Mar, 2023, 19:03

playwright looks like it's for testing. Are you trying to write tests?

Camo
7 Mar, 2023, 19:04

It's for browser automation and can be used for scraping sites, that protect against scrapers, via js value updates. So no.

Drake
7 Mar, 2023, 19:06

i see...ya, you're sort of blocked by the issue linked above (make sure to 👍🏼 it!). I've definitely seen people run into problems where they need some chromium headless browser, but there's no way to install it because it's an OS level dependency. You could try some workaround/hack like including a binary in the uploaded code or something.

Bouahaza
7 Mar, 2023, 19:19

Launch playwright as docker container ?

Camo
7 Mar, 2023, 19:21

Do I understand this right, your suggestion is to make a proxy api ? Client -> Appwrite function -> Docker container api Client <- Appwrite function <- Docker container api Should add a bit letancy and overhead, but is doable i guess..

Bouahaza
7 Mar, 2023, 19:26

Better way should be to create a custom build for open runtimes wich is compatible with playwright

Bouahaza
7 Mar, 2023, 19:27

We use nodejs18 as appwrite function like that

Camo
9 Mar, 2023, 09:13

@Bouahaza could you elaborate on how you run open runtimes with appwrite?

Bouahaza
9 Mar, 2023, 17:11

I asked the people who manage this part for information, I will update here

ireneus
9 Mar, 2023, 17:28

Id be happy to get an update on this aswell

ireneus
9 Mar, 2023, 17:29

i believe you can execute them directly with os.system("command")

Bouahaza
11 Mar, 2023, 15:17
Bouahaza
11 Mar, 2023, 15:17

<:appwriteupvote:899677724615016528>

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more