A Python worker implementation for the lyric.
It allows you to run your python code in a wasm environment.
pip install lyric-py-worker- You can add your dependencies to the
app-requrements.txtfile.
echo "chardet" >> app-requirements.txt- Import the dependencies
src/worker.py
Modify the src/worker.py file to import your dependencies.
import asyncio
# ...
# Import your dependencies at the top of the file
import chardet
# ...
import shortuuid
from lyric_task.std import *- Build the worker
make buildAfter building the worker, you can see the wheel file in the ../dist directory.
ls ../dist/lyric_py_worker-*.whl
../dist/lyric_py_worker-0.1.7rc0-py3-none-any.whlThe output may be like the above.
- Install the worker
You can install your worker using the following command.
pip install --force-reinstall lyric_py_worker-0.1.7rc0-py3-none-any.whlMake sure to replace the wheel file name with the one you have and the path to the wheel file.