Hi @taka-t ,
You will need to vendor any dependencies within your bundle.
It’s as simple as creating a requirements.txt
file and running pip3 install -r requirements.txt --prefix vendor
You may need to manually add the vendor directory to the bundle.zip with something like this:
zip -ur ${bundle}.zip vendor/
Also be aware that you need to be careful about loading these import within your python scripts.
I use this sort of thing
bundle_dir = os.path.abspath(os.path.dirname(__file__))
for lib_dir in [ 'vendor/lib/python3.7/site-packages/' ]:
vendor_dir = os.path.join(bundle_dir, lib_dir)
sys.path.append(vendor_dir)
import jwt
Obviously this is just an example so you’ll need to change it for your lib_dir and import name.
Cheers,
Pete