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

Uploaded CPython 3.10+Windows x86-64

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 45508fd0fbfd6a2c50591f4cf5240e5f3a3a1e538c1e3d2ccbf24afa5d50bf49
MD5 52530b50c6858e4442d0cbc25fecee96
BLAKE2b-256 a953885bfeb42401be8152423c91a94043d04ecc85c9d2d860e1780d522d8b52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 de259c83214ca7975c6324bc0bb930ab17a551612a8187667332e6ac0239ac8e
MD5 2a8027e76d779c551ebcadc24edd1ad2
BLAKE2b-256 7ff1aaf6a9cc778df0cfb4e6f24803e4cf3710c14b58a4df7737d3c8ea119642

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 c0ad1e36fabf45f213b053660fd5d35ed26c359ac7c69683cba856e9c37c4dc3
MD5 64d1b5410cab0f54120d23ea06da3f3e
BLAKE2b-256 a77eff7e4fe702d21d81759d0bc33018ef8fdb146271b2d47bb2c513686ea8ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fd50d795de82c35097bc88a4a7d330b64f17fdd43b257e4d5bf5f3ef0b45bf28
MD5 8eed4492b9548ee1938b1f4605feb78a
BLAKE2b-256 13c3c9ae86f1f0663045b333cfcf0b9c0ebe6f87282158377fe69b70400fdd86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03d4798aed107087ea9fed7825e03b0894f161fe414804c08b1eee768fbfcf71
MD5 c2c7fc8280498034c8df0512e250a117
BLAKE2b-256 a8dff18c4da273363ea29ba5c78d628731b019b29996bc223b305f45a7f8cb09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 789117e87c87340cda930ef874dec051f53d7a8af578ff3db186e539ae54db58
MD5 eda5aa89044586e03c227d5eacac4d44
BLAKE2b-256 6c0eca45c775afdbfa883ea5529ea4ee8355fcc0ff219ab2f938c105d503e622

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4632a62911cf1043c52cd3dca4ff78bc29c15fcfb9354b4cfb8919eea52f1240
MD5 653421336a25c3bc5c7fedaf6ece9c35
BLAKE2b-256 0eec9383a5c014bc60b9a676dbb8ec6ed41889e4c9596a4f78dbd5e0c274c7e0

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