Extra files for one deployment
If your deployment depends on one or two helper files you can include them in your deployment with the extra_files
parameter.
For example, if you use import utils
to access the code within a utils.py
, you can include the utils.py
file when you run mb.deploy
:
import utils # stored at ./utils.py
def my_function(...):
return utils.example()
mb.deploy(my_function, extra_files=["utils.py"])
If utils.py
is in a different directory but is still importable as import utils
, then remap the filepath when deploying:
mb.deploy(my_function, extra_files={ "path/to/utils.py": "utils.py" })
For more information on using extra_files
, see the API reference for extra_files
.
When multiple deployments need these files
Instead of using extra_files
for code that'll be shared between deployments, use common files. Common files are files made available to all deployments.