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.6.0-cp310-abi3-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.6.0-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.6.0-cp310-abi3-musllinux_1_2_armv7l.whl (3.3 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

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

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

nominal_streaming-0.6.0-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.6.0-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.6.0-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.6.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6c87e7c9a9d62f1ebcdc7fe85413d2b53e19c69181507a05a27409f3912c7226
MD5 b5c9cb3a25ab59aa29a5cb48a8146ba6
BLAKE2b-256 2b5877f3b68e52be449202c64314bf09e33d54c457d006aac0a535cfc76a3e54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 788d0443c77f2944477988275dd4d14bf17152aa8ced47bc0884e31f02bbc01f
MD5 873289cbf85b51e6ac1ac8bfcd50c41f
BLAKE2b-256 ab55e909db3216d2f8b11391ec64c19eb7b6c33061ab47c8838e422d00b05e51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 3ce62ba9d367c2c56e812529f476e1619efaa5d512d1e5102503dd52069327e3
MD5 2a6354bbf46bcf846371438b73a11560
BLAKE2b-256 3b2e250aedcb2ea1fe9925684726994bf5209afa9ec3e44ad9fdf637ab5909e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0191fdd2d68d9100f7d66f0251ef00a964cc31a598898e66702b2ac7bd552d96
MD5 b1d40709230128efdf7c7b9d3a6e9349
BLAKE2b-256 db2e9272ad8b947b17cd229e3fdbffd06415f8d3d7606a9000a872671e5702a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c19bb43de2fdc6ec5c85e81571a181c5ab77802a5c7c4bed72f8a7abcfc8f48c
MD5 7ab88069fa526d5df20e0fdc5ea480ba
BLAKE2b-256 657675c28930490e684c0d34339cf7a2a66be07a43a91598e7a146bf8ac9580d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 fa9bc828550bd9a96b63e17063ff4ec1c368d53f6c3a18d8cddd3b666481991f
MD5 880127cfd815522a4f57514b6fbeee2f
BLAKE2b-256 2634c31c0bdb7490ad07aab9a6c7fd0d77d8d18d3ce138f16a55efc43478b5f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.6.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b44d8649e141c02e9c7f04d596bfdbf120880266dfe3adcd0f19882a185319b5
MD5 e67f2b7fa282f4b777ca768e6705d25f
BLAKE2b-256 a2658f3039ce11913fa1eec3668b47d8935bde8aefa5b4a708d654cf355656b1

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