You can write Python scripts (data apps) directly inside Peliqan using Peliqan’s built-in IDE, or you can develop locally on your computer and then deploy to Peliqan.
- Peliqan pip module
- Install
- Upgrade to latest version
- Usage
- Peliqan class arguments
- Environment variables (optional)
- Useful Links
- Bundler
- Creating data apps that can run both locally and inside of Peliqan
- Automated deploys (CI/CD)
- Local deploy script
- Deploy using Peliqan’s REST API
Peliqan pip module
A Python module to connect to a Peliqan environment from a Python script running anywhere outside of the Peliqan environment. This module is a wrapper for the public Peliqan REST APIs.
Install
$ pip install peliqanUpgrade to latest version
$ pip install peliqan --upgradeUsage
Peliqan class arguments
The Peliqan class takes two arguments:
- jwt (required): This is the JWT token used to authenticate requests from the client to the server. In Peliqan, see Admin > Security settings > API token.
- backend_url (optional): This is the
instance_urlthat points to a specific Peliqan environment. If no value is provided, the client will look for thePELIQAN_URLenvironment variable. If it is not set, then the value defaults to https://app.eu.peliqan.io/.
More info on the Peliqan environment URL and JWT token here.
Environment variables (optional)
- PELIQAN_URL: If this variable is set, it is not needed to set the
backend_urlparameter while instantiating the client.
Useful Links
See here to learn more about building data apps.
Bundler
Data apps in Peliqan are single file Python scripts. You can use the Peliqan bundler to combine a multi-file Python script (e.g. a multi-file Streamlit app) into a single file that can be deployed to Peliqan.
Note that the single file script must be tested. In some cases, changes to the source code are required to make the code compatible with the bundler.
Download the bundler:
Usage:
python bundler.py test-project/main.py
Creating data apps that can run both locally and inside of Peliqan
Inside Peliqan, the Peliqan module is automatically imported as pq and Streamlit is automatically imported as st. The constant RUN_CONTEXT is always set, e.g. with value “interactive” when the data app runs in interactive mode.
Click here for more info on run modes (RUN_CONTEXT).
Example background data app that can run both locally (outside of Peliqan) and within Peliqan:
Example interactive data app (Streamlit app) that can run both locally (outside of Peliqan) and within Peliqan:
Automated deploys (CI/CD)
You can automate the deployment of Python data apps to Peliqan by using Peliqan’s REST API as part of your CI/CD deployment pipeline - e.g. using Github actions - or by using a Python deploy script that you run locally to push data app updates to Peliqan.
Local deploy script
Deploy using Peliqan’s REST API
Data apps are called “interfaces” in the Peliqan REST API.
Relevant API endpoints:
- Create a data app
- Update a data app