Skip to main content

SDK for the Uncertainty Engine

Project description

Uncertainty Engine banner

Python SDK for the Uncertainty Engine

PyPI Python Versions

⚠️ Pre-Release Notice: This SDK is currently in pre-release development. Please ensure you are reading documentation that corresponds to the specific version of the SDK you have installed, as features and APIs may change between versions.

Requirements

  • Python >=3.10, <3.13
  • Valid Uncertainty Engine account

Installation

pip install uncertainty-engine

The SDK has optional extras that provide additional functionality:

Name Description
data Installs data processing packages
notebook Installs support for running the SDK in Jupyter notebooks
vis Installs support for visualising graphs

Install one or more of these via pip by providing them as a comma-separated list:

pip install "uncertainty-engine[data,notebook,vis]"

Usage

Setting your username and password

To run and queue workflows you must have your Uncertainty Engine username and password set up. To do this you can run the following in your terminal:

export UE_USERNAME="your_username"
export UE_PASSWORD="your_password"

Creating a client

All interactions with the Uncertainty Engine API are performed via a Client. The client can be defined as follows:

from uncertainty_engine import Client

client = Client()

With an instantiated Client object, and username and password set as environmental variables, authentication can be carried via the following:

client.authenticate()

Using different environments

The Client defaults to using the Uncertainty Engine production environment. To use a different named environment, pass it as the env argument:

client = Client(env="dev")

If a custom environment has been provided for you, pass an Environment that describes the details:

from uncertainty_engine import Client, Environment

client = Client(
    env=Environment(
        cognito_user_pool_client_id="…",
        core_api="…",
        region="…",
        resource_api="…",
    ),
)
Argument Format Example
cognito_user_pool_client_id Alphanumeric string 3vj5pe253j4v070euqjdk38a24
core_api Starts with https://, does not end with / https://de1v75vvk6.execute-api.eu-west-2.amazonaws.com
region Geographic region code eu-west-2
resource_api Starts with https://, does not end with / https://m90q55iux6.execute-api.eu-west-2.amazonaws.com

Note: Every password is tied to a specific environment. A password for the production environment, for example, won't grant access to the development environment. Ensure you set the correct UE_PASSWORD value for the environment you configure.

Troubleshooting

Authorisation tokens are cached in .ue_auth in your home directory. If the SDK fails to authenticate you (for example, after switching from one environment to another), delete .ue_auth to generate and cache new tokens.

To delete the cache in macOS or Linux:

rm ~/.ue_auth

To delete the cache in Windows:

del "%USERPROFILE%\.ue_auth"

Running a node

from pprint import pprint

from uncertainty_engine import Client, Environment
from uncertainty_engine.nodes.basic import Add

# Set up the client
client = Client()
client.authenticate()

# Create a node
add = Add(lhs=1, rhs=2)

# Run the node on the server
response = client.run_node(add)

# Get the result
result = response.outputs

pprint(result)

For more some more in-depth examples checkout our example notebooks.

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

uncertainty_engine-0.14.1.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uncertainty_engine-0.14.1-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

Details for the file uncertainty_engine-0.14.1.tar.gz.

File metadata

  • Download URL: uncertainty_engine-0.14.1.tar.gz
  • Upload date:
  • Size: 38.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.5 Darwin/25.3.0

File hashes

Hashes for uncertainty_engine-0.14.1.tar.gz
Algorithm Hash digest
SHA256 d82120c9093702c320c2774c421b302031177518627ddb19c3fe76d6d0504ab8
MD5 344b4566200fcdb8e451baf4b49b5725
BLAKE2b-256 31c5d34f083c5e6fb533d1a156d0724404e455fa01fc55af67c1fbc65232812f

See more details on using hashes here.

File details

Details for the file uncertainty_engine-0.14.1-py3-none-any.whl.

File metadata

File hashes

Hashes for uncertainty_engine-0.14.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f47724974596a81d107e32e361e62ac9052d69a918e012096f6f11fea8f8547
MD5 ed62d85b8d293e74c8c9e27de6b9ab25
BLAKE2b-256 1e60ec065614f3cb974515ca9d3842a7daa05de78ee5893b78a04fa0bac907d6

See more details on using hashes here.

Supported by

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