Skip to main content

Waylay Python SDK.

Project description

Waylay Python SDK

Python SDK for the Waylay Platform.

This waylay-sdk package provides a basic SDK client for the Waylay REST apis.

See Waylay Docs for documentation.

Installation

This package requires a python runtime 3.9 or higher.

The basic client can be installed with

pip install waylay-sdk

This client provides basic configuration, authorization and plugin features for the SDK.

It includes a generic http client to make authenticated calls to the services available on your Waylay gateway endpoint.

Support for specific Waylay services or tools is provided by separate service and tool packages.

Basic usage

In webscripts and plugins

The SDK client can be used in the python webscripts and plugins of the Waylay platform.

In that case, the webscript or plugin runtime will configure and authenticate a client, and provide it as a waylay parameter to the webscript or plugin callback function.

You just need to state the required SDK package dependencies when authoring the webscript or plugin.

async def execute(request: Request, waylay: WaylayClient):
    # list templates with the query as specified in the request body
    template_query = request.json()

    # with only the 'waylay-sdk' package:
    templates = await waylay.api_client('GET', '/rules/v1/templates', query=template_query)

    # with the 'waylay-sdk-rules' service plugin package
    # templates = await waylay.rules.templates.list(query=template_query)
    return templates

Interactive Authentication

When used outside the Waylay platform (e.g. in a python notebook) the client requires you to provide

  • the gateway endpoint: api.waylay.io for Enterprise users,
  • an API key-secret pair: see Waylay Console at >Settings>Authentication keys.
from waylay.sdk import WaylayClient

# this will interactively request the gateway and credentials on first usage.
client = WaylayClient.from_profile()

# list the available service packages
client.services

# use the generic api client to see the status page of the 'registry' service.
resp = await client.api_client.request('GET', '/registry/v2')

Credentials and endpoints are stored in a local profile file (you can have multiple such profiles). Other authentication methods are available (JWToken, pass apiKey/Secret directly)

Service packages

Support for a specific Waylay REST api comes as a separate service package. Each service provides two packages:

  • an api package waylay-<service>-sdk that describes all resources and actions for that service. JSON request and responses are represented as basic python data (dict, list, primitives)
  • a types package waylay-<service>-sdk-types that provides pydantic models to represent JSON request and responses.

The types package is optional. When installed, its pydantic models are used to serialize requests and deserialize responses. When used in a python IDE, code completion will help you navigate the attributes of request and responses. This makes it easier to interact with the API as a developer. But as the underlying REST api evolves, the types package might require regular dependency updates.

Use the types package for interactive cases (python notebooks), or solutions that are regularly tested and maintained.

When not installed, the SDK client does not interfere with the json representations of requests and responses, and you should check the API documentation of the service for exact specifications.

The Service plugs are generated from their openapi description.

waylay-sdk-alarms Alarms api package

The waylay-sdk-alarms package provides the client bindings for the Alarms service, based on its openapi specification.

## with types
pip install waylay-sdk-alarms[types]

## without types
pip install waylay-sdk-alarms

waylay-sdk-data Data (broker) api package

The waylay-sdk-data package provides the client bindings for the data api of the broker service, based on its openapi specification.

## with types
pip install waylay-sdk-data[types]

## without types
pip install waylay-sdk-data

waylay-sdk-resources Resources (digital twin) api package

The waylay-sdk-resources package provides the client bindings for the resources service, based on its openapi specification.

## with types
pip install waylay-sdk-resources[types]

## without types
pip install waylay-sdk-resources

waylay-sdk-rules Rules (rules engine) api package

The waylay-sdk-rules package provides the client bindings for the rules service, based on its openapi specification.

## with types
pip install waylay-sdk-rules[types]

## without types
pip install waylay-sdk-rules

waylay-sdk-storage Storage (file object storage) api package

The waylay-sdk-storage package provides the client bindings for the storage service, based on its openapi specification.

## with types
pip install waylay-sdk-storage[types]

## without types
pip install waylay-sdk-storage

waylay-sdk-registry Function Registry V2 api package

The waylay-sdk-registry package provides the client bindings for the registry v2 service, based on its openapi specification.

## with types
pip install waylay-sdk-registry[types]

## without types
pip install waylay-sdk-registry

Tool packages

Tool packages provide SDK extensions for specific use cases.

waylay-sdk-ml-adapter ML Adapter tool package

The waylay-sdk-ml-adapter package provides utilities for using and deploying Machine Learning models in plugs and webscripts.

## basic install
pip install waylay-sdk-ml-adapter

## install with support for pytorch models
pip install waylay-sdk-ml-adapter[pytorch]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waylay-sdk-0.0.5.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

waylay_sdk-0.0.5-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file waylay-sdk-0.0.5.tar.gz.

File metadata

  • Download URL: waylay-sdk-0.0.5.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for waylay-sdk-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9166eaf9a730936629ac122eff9a18f70e99cb02ca95eb4f93e114fb04d188b2
MD5 206220bcd3369ed88df3498a89130086
BLAKE2b-256 056a8766c4677b3b8b63ae026561d6610bf1377f66d70b88cfc30e995fcd614e

See more details on using hashes here.

File details

Details for the file waylay_sdk-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: waylay_sdk-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for waylay_sdk-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 93e6b649dd77bb7c3eaff639da40778eb0e5dc98cfe7130489ffbcdb7bbd93a3
MD5 2e84215dc698cebec933051bcfe19877
BLAKE2b-256 feedbe4d544ff3f88f03fd942b626ddb4eb98786c2f7e81d82464297fc081d6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page