Skip to main content

WarpZone SDK

This package contains tools used in the WarpZone project. These tool include:


Client for Storage

Blob storage

WarpzoneBlobClient client is used for uploading to and downloading from Azure Storage Blob Service.

storage


Client for Servicebus

Due to limitations on message sizes, we use different methods for sending events and data using Azure Service Bus.

Events

We use the Service Bus for transmitting event messages. By an event, we mean a JSON formatted message, containing information about an event occuring in one part of the system, which needs to trigger another part of the system (such as an Azure Function trigger).

WarpzoneEventClient client is used for sending and receiving events.

eventclient

--

Data

We do not use the Service Bus for transmitting data directly. Instead, we use a claim-check pattern, were we store the data using Storage Blob, and transmit an event about the details of this stored data.

WarpzoneDataClient client is used for sending and receiving data in this way. The following diagram shows how the process works:

  1. Data is uploaded
  2. Event containing the blob location is send
  3. Event is received
  4. Data is downloaded using the blob location contained in the event

dataclient

The transmitted event has the following format:

{
  "container_name": "<container-name>",
  "blob_name": "<blob-name>",
  "timestamp": "<%Y-%m-%dT%H:%M:%S%z>"
}

The data will be stored with

  • <container-name> = <topic-name>
  • <blob-name> = <subject>/year=<%Y>/month=<%m>/day=<%d>/hour=<%H>/<message-id>.<extension>

Function Wrapper

For executing logic, we use a framework built on top of Azure Functions. The following diagram shows how the framework works:

  1. The function is triggered by a trigger object (e.g. a timer or a message being received)
  2. Possible dependency objects are initialized (potentially using information from the trigger). These are used to integrate with external systems (e.g. a database client).
  3. Using the trigger and dependencies as inputs, the function outputs and an output object (e.g. a message being sent).

function

The reason we have used our own framework instead of Azure Functions directly, is that we want to use our own objects as triggers, dependencies and outputs, instead of the built-in bindings. For example, as explained above, we have created our own abstraction of a message for transmitting data (warpzone.DataMessage); so we would like to use this, instead of the built-in binding azure.function.ServiceBusMessage.

Since it is not yet possible to define custom bindings in Python, we have defined our own wrapping logic, to handle the conversion between our own objects and the built-in bindings. The following diagram shows how the wrapping logic works:

  1. Azure trigger binding is converted to trigger object
  2. Either
    • (a) Output object is converted to Azure output binding.
    • (b) Use custom output logic, when no suitable output binding exists (e.g. we use the Azure Service Bus SDK instead of the Service Bus output binding, since this is recommended)
  3. All logs and traces are sent to App Insights automatically.

function-wrap

--

Examples

Azure Function with data messages as trigger and output:

# function.json
{
  "scriptFile": "__init__.py",
  "entryPoint": "main",
  "bindings": [
    {
      "name": "msg",
      "type": "serviceBusTrigger",
      "direction": "in",
      "connection": "...",
      "topicName": "...",
      "subscriptionName": "..."
    }
  ]
}
import warpzone as wz

def do_nothing(data_msg: wz.DataMessage) -> wz.DataMessage:
    return data_msg

main = wz.functionize(
    f=do_nothing,
    trigger=wz.triggers.DataMessageTrigger(binding_name="msg"),
    output=wz.outputs.DataMessageOutput(wz.Topic.UNIFORM)
)

Azure Function with HTTP messages as trigger and output:

# function.json
{
    "scriptFile": "__init__.py",
    "entryPoint": "main",
    "bindings": [
      {
        "authLevel": "anonymous",
        "name": "req",
        "type": "httpTrigger",
        "direction": "in"
      },
      {
        "type": "http",
        "direction": "out",
        "name": "$return"
      }
    ]
  }
# __init__.py
import warpzone as wz
import azure.functions as func

def return_ok(req: func.HttpRequest) -> func.HttpResponse:
    return func.HttpResponse("OK")

main = wz.functionize(
    f=return_ok,
    trigger=wz.triggers.HttpTrigger(binding_name="req"),
    output=wz.outputs.HttpOutput()
)

Azure Function using dependencies:

import warpzone as wz

def do_nothing(
  data_msg: wz.DataMessage,
  db: wz.WarpzoneDatabaseClient,
) -> wz.DataMessage:
    return data_msg

main = wz.functionize(
    f=do_nothing,
    trigger=wz.triggers.DataMessageTrigger(binding_name="msg"),
    output=wz.outputs.DataMessageOutput(wz.Topic.UNIFORM),
    dependencies=[wz.dependencies.DeltaDatabaseDependency()],
)

Metadata

Release files for warpzone-sdk 19.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for warpzone-sdk 19.1.0
File Size Uploaded Provenance Actions
warpzone_sdk-19.1.0.tar.gz 21.2 kB Without provenance Details for warpzone_sdk-19.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for warpzone-sdk 19.1.0
File Interpreter ABI Platform Actions
warpzone_sdk-19.1.0-py3-none-any.whl Python 3 none any Details for warpzone_sdk-19.1.0-py3-none-any.whl

Total release size: 51.2 kB

Release files / warpzone_sdk-19.1.0.tar.gz

Download URL warpzone_sdk-19.1.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f481353626227420dc315619433ecbe359c282f8a254d4c446266487e837392d
BLAKE2b-256 checksum
How to use checksums
75a6805460a5c374314178a369fb31d4915a98ee6976ef991ee99445d3170af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.10.22 Linux/7.0.0-1019-azure

Release files / warpzone_sdk-19.1.0-py3-none-any.whl

Download URL warpzone_sdk-19.1.0-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34950c80fb5ae09d7af44e330546f4001ef0c1ba1a5a4a4380e937bf0cc9ffd1
BLAKE2b-256 checksum
How to use checksums
272c67d7c1115f556d9b4165e690a55a5bfbc86c436383eb9cc0087bcff45ff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.10.22 Linux/7.0.0-1019-azure

Security for warpzone-sdk 19.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

19.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page