Dependent Libraries

Supported Dependent Libraries

FunctionGraph supports both standard and third-party libraries.

Importing Dependent Libraries

Importing a dependency for Python:
from com.obs.client.obs_client import ObsClient
Importing a dependency for Node.js:
const ObsClient = require('esdk-obs-nodejs');

For standard libraries and supported non-standard libraries, you can directly use them in your function.

For non-standard third-party libraries that are not provided by FunctionGraph, you can use them by performing the following steps:

  1. Package the dependent libraries into a ZIP file, upload the ZIP file to an OBS bucket, and obtain the OBS link URL.
  2. Log in to the FunctionGraph console, and choose Functions > Dependencies in the navigation pane.
  3. Click Create Dependency.
  4. Set the dependency name and runtime, specify the OBS link URL, and click OK.
    Figure 1 Setting the dependency
  5. On the function details page, click the Code tab, click Add in the Dependencies area, select the dependency created in 4, and click OK.
    Figure 2 Selecting a dependency

    Each dependency package cannot contain a file with the same name as a code file. Otherwise, the two files may be incorrectly merged or overwritten. For example, if dependency package depends.zip contains a file named index.py, the handler of a function cannot be set to index.handler. Otherwise, a code file also named index.py will be generated.