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

Uploaded CPython 3.10+Windows x86-64

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d44f923535ec2518b5be8f858786d84bbb145e030ec967ec788a7b294b7ded71
MD5 eced5937bf7c72307950e7b22369ef95
BLAKE2b-256 fc38bec046497bbf09caf39620844e73554a2153fb0002ca48af577bea0b0290

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ceb1b409097dd41839c0b5b473d381df72652c2843046af8669ddd227f0cfe22
MD5 b6204bee5ba0a0f00e95530d1efd8d6f
BLAKE2b-256 50a4f6d8d38b358fd7c52351a866141c03ba025b825603e3ee91374ecf57ee5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 90e5524f24ca1ab8eeced3d12aee11ddd3e3b5c7740eef90960004441dd5c2ee
MD5 73ce473f8d30dfdf17c377f5770c57ad
BLAKE2b-256 5f4f0f75636401f6ff92fdb3815d9df68666d4584c666fc726905d1951c5fc6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ac926fe95ee7ed0802cc473659b47b3102e494e1e556110e7dd4c9ffc5aa2b12
MD5 cef65e5171ac35cf17e27c3dc7bdd9f2
BLAKE2b-256 02035bb460918730632bcb39d8902de0c8d5902da1d82e6a8554a45073a0ae32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7b1ed1189362213358226956a8acf15ae19f06d3853d4e73c371655d6b2738c7
MD5 861be6a1301b647d5de9bc77f72546d0
BLAKE2b-256 efd738f892dd247ce03a25d32bd20baacdb9b5488d3e09e7237d9f4edbbebca2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 fbe9ce43d483a0c47a76da934e7251d8e9a74690f859a42e27d9d092a1bc3806
MD5 38a7a6bccfafbea017c0045e9233b9d8
BLAKE2b-256 08a6e2f36be72b336b9f125e4eb0073230ade3171604e7f5480c412497b832d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.7-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5294a6fa2d6b9915074ab3a2ce24d62b0fb3f3eef4487e5827d70e9d18d3352
MD5 15d68cd8a2e110166af452cc78011c60
BLAKE2b-256 43f112a35328e8d29fd338f3a520ded6b008c4c9ddb5108be5437c5122ebde1b

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