Developer guide

Import external package/repo in your brick

Here is a small guide on How to use external resources in your brick. This guide explain how you can import a python package using pip and also how can you can script or python code during your brick installation to initialize requirements for your brick.
Before adding an external package/repository to your brick please check if using a virtual environment can solve the issue. We recommend using virtual environment for external package as they will not be in conflict with other dependencies.

Use a pip package

You can use external pip package for your brick. Install it with pip in Codelab and test your brick with it. Once you are happy with it, you will just need to declare it in the setting.json file. This is required for the system to install the package when the brick will be installed.
In the settings.json file edit the environment > pip object. Add your package under the correct source. Use the PyPi source https://pypi.python.org/simple to use the default pip source.
The source tells pip where to get the package from.
Under the packages key, provide your package with the version of it. We recommend to write the exact version of you package to make your brick more consistent.
You can use the command pip show to show information about the package and get the version installed.
Here is a example where we added the package openyxl version 3.0.10. The pip source for this package is https://pypi.python.org/simple which is the default pip source.

  "environment" : {
  "pip": [
      "source": "https://pypi.python.org/simple",
      "packages": [
          "name": "openpyxl",
          "version": "3.0.10"

If a classic python package is already install in the system like : pandas, numpy, tensorflow... please do not declare it in your settings.json file. Thoses packages must be defined only once in your lab in order to avoid problem with versions.