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

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.7.3-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.3-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.3-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.3-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.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 093780e80386f4e1de93a5bc9a9cb95c54de857577f868096d85961b9331d869
MD5 e214829fa0ad2d660c55b73a7422351b
BLAKE2b-256 3d63e0c4f999c9ed570fbc3fd9f65223898b9dc055e14516b501230daa9059d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 34c1222abdf8d63fd4ad80378ae6becad7229657b9ebfa19fce4028c8ee4a8b6
MD5 6026232428c08cfb7ca57c545f264b0e
BLAKE2b-256 9c695225b937c70b5bc02b047dccbd03e24e034636256e261ab5650acd1cda28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 6a852e227cc99506776dfaf95ebcd325b227cab391d3758b803cb43dd9940fa7
MD5 f3aa1c8a6eb285b238b52ec0672ad64b
BLAKE2b-256 81ce1bb40e6a53d3577813277884c42d91ed99bd8c48e7c5349347bbbaf54134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 39bcfe9d7b9c2ced213e28edde294a47e003ef8ad003c3c59e6848f46323d433
MD5 22cb744e2a42108182bfc4041a8cbf50
BLAKE2b-256 76112d531ff83bd2a7dd444b0878f434c9df674c43fce6001f28db9c39b271d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2884be07ffb8cf417c59df5528edd6aef8734833adb89daa9611dce38c2d398d
MD5 a1469947a05ac4f72bcdb2e39052f300
BLAKE2b-256 1ee0b6b3f4b3014d4f399c54167c322ca7b6cb51a54afffee90b957c551468f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 bde24ff5ed9d230e5e9dfdd8b1441483d6fb8a81f642eb364c758f1b5afead29
MD5 c4a3515e747cf8f0efe07232082f9076
BLAKE2b-256 00fe1f9ebfc23521131a380c6eb6d8c3bbef42d9860051657f6e4c2544fa2357

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9cfb8d1281e91f599f421fbeb39d9423ab79847f413b5ff2f5a97d0df282ed77
MD5 e134297c3e57df2abdb7fd68d513adc2
BLAKE2b-256 9e08b2683d11007c2084ae7211c108715ca9d814d4fe172716e8bad4fde73371

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