Python Project Integration with Sequentum Cloud Agents
This document outlines the process of using external Python libraries within the Sequentum Cloud environment. If the required libraries are not pre-installed or supported by default, you can incorporate them by following these steps.
Install Required Library to Local Machine:
Use the below command syntax to install the library on the virtual environment.
Command Syntax-:
pip3 install <library-name> --platform manylinux_2_17_x86_64 --only-binary=:all: --target <Path> --no-userExample: Suppose we want to use ”TikToken” Python Library then below syntax would be used.
pip3 install tiktoken --platform manylinux_2_17_x86_64 --only-binary=:all: --target c:\test\temp --no-userCompress the installed Libraries into a Zip:
Now to upload and use the installed library and its dependencies, follow below steps:
Open “File Explorer” and go to the path passed in the target variable while installing the library.
Once you have reached the folder under which all the libraries are installed the folder will look like this.
Now, select all the files and compress them into a zip file and name the zip file as per your need.
Upload Zip file:
Now that your Zip file is ready for usage, upload the zip file either on the Space where your agent is available or upload the file under your agent “File” section.
Upload as “Shared File”,
Upload as “Private File”
Use Zip File
Now, to use the external Python Library Zip file we just uploaded, we have to add that file as assembly reference in the script to use the external Python Library.
If a Zip file is added as a Private File we will use the below format for adding the zip file as assembly reference.
Syntax: #@private ‘<Zip_file_name.extension>’
#@private 'Test.zip'
from se_scripting_utils import *
import tiktoken
def get_data(context: RunCntext):
return ""
If a Zip file is added as a Shared File we need to use the below format for adding the zip file as assembly reference.
Syntax: #@shared ‘<Zip_file_name.extension>’
#@shared 'Test.zip'
from se_scripting_utils import *
import tiktoken
def get_data(context: RunContext):
return ""
Now, the External Python library is ready to use, write the script as per your requirement.