The Python data source is one of the integration methods available on the Kuika platform that allows you to develop custom functions and business logic. Using Python, you can define custom operations within your application, create functions that accept parameters, and use these functions in application workflows.
With the Python data source, you can write custom code to address needs beyond the built-in actions, customize data processing workflows, and create reusable functions.
You may need to have an appropriate subscription plan to use the Python data source feature. You can upgrade your subscription to access more advanced development tools.
Add a Data Source Connection to Your App Using Python
Log in to the Kuika platform and open the project you’ll be working on from the Apps screen.
Open the Data Sources module.
Here, you can view existing data sources and add a new one.
In the left panel, click the + icon next to the Sources heading.
Select the Python option.
Enter a name for your data source.
Click the CREATE button to complete the process.
Anatomy of the Python Action Modal
A. Top Menu
Title (Python Action): The modal’s title indicates that the created data source is a Python-based action.
CREATE Button: Used to save the Python data source you’ve created.
Close Button (X): Used to close the screen and exit the process.
B. Top Settings Area
Name: This field allows you to enter a description of what your function does. It helps other developers—or even you in the future—remember the purpose of the code.
External Libraries (BETA): This field allows you to add external libraries to use in your Python code. It is currently labeled BETA.
Python version: A drop-down menu that lets you specify which Python (CPython) version your code will run on. Supported versions:
CPython 3.14.6
CPython 3.13.14
CPython 3.12.13
CPython 3.11.15
CPython 3.10.20
By default, the latest version (CPython 3.14.6) is selected; you can choose an older version as needed.
Generate with AI: This option is used to automatically generate Python code with AI support. When enabled, you can receive code suggestions from the system.
C. Python Editor
This is the code editing area.
All custom functions are defined here.
Default example structure.
defnew_function(parameter1: str) -> str:# Your code here return parameter1
This structure demonstrates the following:
Functions are defined using the `def` keyword.
They can accept parameters.
The parameter type can be specified using a type hint (: str).
The return type can be defined as -> str.
In the function body, the area where you will write your code is marked with a comment line (# Your code here).
D. TIDY UP Button
Located in the upper-right corner of the code editor.
It is used to format, indent, and make the written code more readable.
E. Test Console
This area, located at the bottom of the screen, is used to test the functions you’ve written.
In this section:
The function list is displayed.
Parameter input fields are provided.
The output results can be viewed.
Configuring Python Data Source Settings
Manual Code Writing
If “Generate with AI” is turned off, all code is written manually directly in the editor.
If you enable the “Generate with AI” feature, you can create code automatically by writing a description.
Example command:
Create a function that converts the entered text to uppercase.
Python Version Selection
You can select the CPython version your code will run on from the Python version dropdown menu. Since language features or library compatibility may vary between different versions, it is recommended that you select the version that best suits your project’s needs.
Using External Libraries (BETA)
Through the External Libraries section, you can include additional packages in your project beyond the standard Python libraries. This feature is currently in the BETA phase.
This function takes two numbers and returns their sum.
Specifying the Return Type
The data type to be returned must be specified in the function definition using the -> symbol.
Example types:
str
int
float
bool
dict
list
Any
Testing Functions with the Test Console
After writing your code, you can use the Test Console section below.
Select the function you want to test.
Enter sample data into the parameter fields.
Run the function.
Check the returned result.
Example:
defhello(name: str) -> str:return"Hello " + name
Parameter: Kuika Expected output: Hello Kuika
Saving the Data Source with CREATE
After completing and testing your code, you can save the Python data source by clicking the CREATE button. The saved data source becomes available for use within the application.
Expected Output / Result
Once these steps are completed:
The Python data source is added to the Sources list.
The defined functions become available for use in the system.