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.

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

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.7.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.7.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.7.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.7.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.7.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.7.0-cp310-abi3-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e76b019a08e41c37e2dddf47fb218516be892ac1b35e9ebdf0e37494d5ab5e64
MD5 65ba942d7eac9d1fa32866319b3a250a
BLAKE2b-256 964949a100a4dda8cbe8d744a890f1f437b06a9958e0a2f307cbe6882f2987f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 45d15820c7f4bddae9b98a763721df46a09fe8be744dba52dbede98cc14415c3
MD5 b37af3143e7ff611f5a57946b2dc95e6
BLAKE2b-256 a8a9d75ce479dfa5b37fd83abac07aefa37a6a592dcba4e3433413b091cdf82a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 f82c848d20af52267317b65fbcc51941aa407a6029fef7b1cfa56702793ceff7
MD5 0b8048ccc58b631c2efec88d2f89ebf8
BLAKE2b-256 07c0d3617633183d102c6df0a6b82e62bc28956ad96b425bc3cb6de68690c900

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6fc6b81d115349c6a5c87960fa9f8f75b2bd869679cd7d61948afa965761658f
MD5 b60138f119b4dfa2aa17d661a447d77b
BLAKE2b-256 f9f73d45ac9f387a34201decab2972e881bce732a3ae6dc94932dd8bd7614e8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1ed24fa0fba6b87e6e0a814718f3355745cdb8e17238370f4e19747817a4f68
MD5 b9bdcedb0e696c3d52a391ed7b7d15cd
BLAKE2b-256 83bd62103c0bcf1733b5fb55a5ca0f8784977c872ef4b2365d89c1cf8a83c61c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6fad7463331bc5eb81155a203964ce3fcc7acf56e23f3e373ee6f383b77a25aa
MD5 cac3ab19eedfb99d739e1ca5dabf1e14
BLAKE2b-256 90eb6b3cfcb0bcb36ce3d9db1bc96f581fe1084488966acc831dc169c70eeefe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 280549cda78a81c2fd87710a19b133b0768fddb54f53877e20be230595ec5879
MD5 16523714d3757c89375b8928374912ce
BLAKE2b-256 cb5cd65668e1da4cc202d6936b2abb061be21c321524c74ba27e639c43c8455a

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