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

Uploaded CPython 3.10+Windows x86-64

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 03e2e79ed864838bab931defdffb45c80aacfa4bc397757ce91eef2bb1db4c60
MD5 8440b914f9700675a2f00ab3e24da3e3
BLAKE2b-256 b2078b42d6167735cf3ee1d3b2907ced8c7a2114f9f8f267315b4969ee1de25f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0ed6c7fa59fd91760df7bf66b014401b849f0bbc122c01a9419fc9e51e9be284
MD5 21a0de40162455c2bfffce63f24cd12f
BLAKE2b-256 03350914c5bfe84009fc078fc55987b661df322c4e3f6cd844526a683977461d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 d0416970e48e9589f1844e7762e10b91a3b1f9bd160d46f24337e57422063584
MD5 139b6b10e20a502a321f5acfb06972cd
BLAKE2b-256 c674c14d447d95b5eb01559c3b4fae0b47166cf00e42a8c87eb75b799c989d62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 641d64fe53e9fe637eb77bdf8402a94439d7d763b7c082e477492880cca15c61
MD5 1743f876d162a3e7eb01c32e6e3e59b1
BLAKE2b-256 655a66905431b04c1cb481a74d0f74c7a3affed354b0ec2f09aab41db159e599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bf2f536955aaff4e1b2701c46929c2d335a974282b95d048c46d186d06441adb
MD5 84ba57b6bb2b7ae0b59c2a52be8be08f
BLAKE2b-256 f93cb22ab8230093ececa2682cb3de38fada22e961de0ce1367dcd2e497b8101

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 011bd5d142ac4009ff6ddc22eba0c042783238b910c61020d054fd65d3e850c5
MD5 ad80c9ef15cdc46d7f965c3527845432
BLAKE2b-256 4237ebeadaaf7e38f6cabbb3e19a9144e2771c25c2b506a359a07f89e568dbbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2fb86494c30bdb772f371e24a2d18581a2c5c855e001f91599d78e8106214bf
MD5 5b7ab65570103668ba301eb62f6e9f93
BLAKE2b-256 8a58ac6dd9742231a5fb24bec8fd093046e2eded6bc5c065f4cb30e78c09c6a6

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