Login
Back to bricks list
Introduction Version

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.



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.



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.



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"
        }
      ]
    }
}