Python SDK
Getting up and running with the Superwise SDK
Superwise's SDK is a standard Python package that simplifies the integration with Superwise and streams data to the Superwise platform.
Python SDK Reference Guide
You can find more information about each function and method in our Python SDK reference guide.
Pre-requisites
Minimum Python version supported by the recent SDK is 3.7 and above
Installation
pip install -U superwise
Environment variables
There are 2 environment variables used to identify and authenticate your connection:
- SUPERWISE_CLIENT_ID
- SUPERWISE_SECRET
Read here more on how to generate them.
Package structure
Superwise object - create an instance of a Superwise object to interact with the Superwise APIs.
import os
from superwise import Superwise
os.environ['SUPERWISE_CLIENT_ID'] = 'REPLACE_WITH_YOUR_CLIENT'
os.environ['SUPERWISE_SECRET'] = 'REPLACE_WITH_YOUR_SECRET'
sw = Superwise()
For on-prem users
initiate
Superwise
with an additional argument -superwise_host
(the domain defined in the installation phase of Superwise, for example -superwise.example.com
)sw = Superwise(superwise_host=<your internal superwise host>)
All APIs will now be accessible under the sw instance. For example, all task APIs (create, get, etc.) can be found under the sw.task object.
Each object uses a Superwise model, which is an internal SDK representation of a given piece of data.
from superwise.models.model import Model
diamond_model = Model(
name="Diamond Model",
description="Regression model which predict the diamond price"
)
diamond_model = sw.model.create(diamond_model)
print(f"New task Created - {diamond_model.id}")
Task has properties such as id, title, etc. You can use the get_properties() method to pull a list of all properties for a specific object.
print(diamond_model.get_properties())
Updated about 1 year ago