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.0.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.0-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uncertainty_engine-0.14.0.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.0.tar.gz
Algorithm Hash digest
SHA256 cf08ff78aa5db44fa86d0e2bbf9f16ee21821539045a736582662533c1b45807
MD5 fdc3644b685d6f25f773582736c30f4e
BLAKE2b-256 b5d4002ba35f66a6dc9d084dd12c83c351cb7c7bef675d958508a9c76b528d00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for uncertainty_engine-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac63fbe95d940a7e28666c9de70c56b13fb9007baa0deda20f73d680a65b97b8
MD5 e5adee136dce37642f23f3671e35002a
BLAKE2b-256 f6e0a000a835cf59c9d0fcfbf727a4f58fbceec750fbd752dfe0aa594abb5176

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