Skip to main content

Python bindings for the Nominal Rust streaming client

Project description

nominal-streaming Python Bindings

nominal-streaming is a thin python wrapper around the existing nominal-streaming rust crate. Usage semantics remain largely the same, but with some slight alterations to allow for a more pythonic interface.

The library aims to balance three concerns:

  1. Data should exist in-memory only for a limited, configurable amount of time before it's sent to Core.
  2. Writes should fall back to disk if there are network failures.
  3. Backpressure should be applied to incoming requests when network throughput is saturated.

This library streams data to Nominal Core, to a file, or to Nominal Core with a file as backup (recommended to protect against network failures). It also provides configuration to manage the tradeoff between above listed concerns.

[!WARNING] This library is still under active development and may make breaking changes.

Simple usage example: streaming from memory to Nominal Core with file fallback

import pathlib
import time

from nominal.core import NominalClient
from nominal_streaming import NominalDatasetStream, PyNominalStreamOpts

if __name__ == "__main__":
    num_points = 100_000
    stream = (
        NominalDatasetStream(
            auth_header="<api key>", 
            opts=PyNominalStreamOpts(),
        )
        .enable_logging("info") # can set debug, warn, etc.
        .with_core_consumer("<dataset rid>")
        .with_file_fallback(pathlib.Path("local_fallback.avro"))
    )

    with stream:
        # Stream 100_000 live readings (made up values)
        for idx in range(num_points):
            time_ns = int(time.time() * 1e9)
            value = (idx % 50) + 0.5
            stream.enqueue("channel_name", time_ns, value, tags={"tag_key": "tag_value"})
        
        # Stream 100_000 points in one batch
        start_time = int(time.time() * 1e9)
        timestamp_offsets = int(1e9 / 1600)
        timestamps = [start_time + timestamp_offsets * idx for idx in range(num_points)]
        values = [(idx % 50) + 0.5 for idx in range(num_points)]
        stream.enqueue_batch(
            "channel_name", 
            timestamps, 
            values, 
            tags={"tag_key": "tag_value"}
        )

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

nominal_streaming-0.5.5-cp310-abi3-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_armv7l.whl (3.3 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl (3.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

nominal_streaming-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

nominal_streaming-0.5.5-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

nominal_streaming-0.5.5-cp310-abi3-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5cae1e19c4a44dbd0b537f913b8b91ec0b7fbf49e93e8b428cdded8f2df86670
MD5 813d68a5633d3466e5837121e88570f6
BLAKE2b-256 914e7ab0bf0d95ac6a632bd073fc0fdaa5d891570a5c8288406dc424f483ded3

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5dae22c73f855a983f4e644b2c1c9dc0f09006683d4ffcd4eb93d897b92f1ef3
MD5 b8841f5f8a7cd3d7094696ec86488800
BLAKE2b-256 fc89a0f5937797a4f9c148af666e788b65945f7541506e001973bf8785ded6e8

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 3c55bf34cb56fccf1c4b17240ee226f5ed05ae5eaebb88a0b44e672caf4b26a9
MD5 636f495a99453a76cfa29ba67f0aab6d
BLAKE2b-256 172f86e70c3c8b287fa0b195e9e4202f9f33a2435db23a93d357c8fba92cf2b1

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8bc5d74fdbb2f069d840ecf926c1c0ca49b107b82a7cb07ffc373d9830dbc20c
MD5 7139cfafdf8dcb9e1adf0f16301c5af7
BLAKE2b-256 dd72c69664a68c486e8ac15ce4b32090a77f99b35cf59dcbb25e04a6f1995a09

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31b4090c394ddccf6d8d61846b45c07871a37777af1afbf3763c9c01df881613
MD5 b6553be234d74414845c343773f6853a
BLAKE2b-256 b63fbd1b7176eba8dd8aaab5aa3f5cfb80985e288c1194a0657f548d893570e4

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 f21aa7cc7bb339ee535b81e63751ff6384a33bd295f6acfa693a32b2d504b97a
MD5 a74ff2739cd1509d596f90c5808d92eb
BLAKE2b-256 36aac940b002f4ebb07c173afa2eb1bce01290172b6d005eaba9e4a084a51799

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.5.5-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a19793ed79823385d9cb2980ec8edaaa330b48c988cbbcbfc5e066700ad67d6
MD5 382321703d3543dedf8c829a539586a7
BLAKE2b-256 74c6d1b1cf40ede7bea0ecc2bcfca23f9747bd9e1572bcaa2bd9ac0972f21857

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