External dependencies#

More than often you will need 3rd party libraries and application along your code in a SimpleSwitch™ container. For this we offer support for fetching those using the programming language specific package management.

Install Python packages with pip#

From a workspace containing a Python application run

$ mkdir -p externals
$ pip3 install <package name> -t \
    ./externals/usr/lib/python$(python3 -c 'import sys; print(f\"{sys.version_info[0]}.{sys.version_info[1]}\")')/site-packages

to include those 3rd party packages you need to change the add --copy-dir ./externals:/ to your simpleswitch-generate-package command line. E.g.

$ simpleswitch-generate-package --name simpleswitch-example --copy-dir deploy_dir --copy-dir ./externals:/ \
     --template python --startup-command /usr/bin/app.py

Note

Our VSCode extension includes support for that, see Visual Studio code integration for more details.

Install Flutter packages#

From your flutter workspace you can run

$ flutter pub add <package name>

see pub add command help page, for more details.