Build Lightweight Python Components

    Lightweight Python components do not require you to build a new container imagefor every code change. They’re intended for fast iteration in a notebookenvironment.

    Advantages over container components:

    • Faster iteration: No need to build new container image after every change(building images takes some time).

    There are several requirements for the component function:

    • The function must be stand-alone.

      • It should not use any code declared outside the function definition.
      • Any imports should be added inside the main component function.
      • If you need to import a package that’s not available in the default baseimage you can try to find a container image that already includes therequired packages. (As a workaround you can use the subprocess moduleto run for the required package.)
    • If the function operates on numbers, the parameters must have type hints.Supported types are int, , bool. All other arguments are passed asstrings.

    Tutorials

    See the notebook onfor an example of creating lightweight Python components and using them in apipeline.