Describe the bug
Hi,
I wanted to run a Python module with dependencies.
When running the following code, I get an
ModuleNotFoundError: No module named 'bs4'
import bs4
def worker(req):
res = Response(req.body)
res.headers["x-generated-by"] = "wasm-workers-server"
return res
I guess I need to mount my dependencies or install them in wws (?)
But I could not find any documentation about it.
Reproduction steps
- Store the above code as
index.py
- Run it with
wws -i
- Send a request to the server: http://127.0.0.1:8080
Expected behavior
No error when importing modules.
Additional context
Things I tried:
I checked the documentation, but could not find anything about adding dependencies in python based modules (only Rust).
However I tried to create a _lib directory with the bs4 dependency and mount it.
index.toml
[[folders]]
from = "./_lib"
to = "/mnt/lib"
I adjusted the import to import lib.bs4, but this didn't worked. It says that the lib module is not found.
Thanks,
Dennis
Describe the bug
Hi,
I wanted to run a Python module with dependencies.
When running the following code, I get an
ModuleNotFoundError: No module named 'bs4'I guess I need to mount my dependencies or install them in wws (?)
But I could not find any documentation about it.
Reproduction steps
index.pywws -iExpected behavior
No error when importing modules.
Additional context
Things I tried:
I checked the documentation, but could not find anything about adding dependencies in python based modules (only Rust).
However I tried to create a
_libdirectory with thebs4dependency and mount it.index.tomlI adjusted the import to
import lib.bs4, but this didn't worked. It says that thelibmodule is not found.Thanks,
Dennis