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

Uploaded CPython 3.10+Windows x86-64

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1b6bdffc4891c00a5cfad8b98c8f54511a52ae1d24340f3be84c64e52f0f6fd6
MD5 8ef0e6e521719e3ff8ea7de4fb2f1d43
BLAKE2b-256 672b7eee1621dae381d817f16131e73e75d920b4d35596452bfefcddce95d978

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c01451475744110a6c271535ea2fbb8c88d996b4eae9a0a4958229d1bc27efee
MD5 254c826b7bc34105e70c1514c4199527
BLAKE2b-256 bb0a93c313cb11e51b95865254db080aa5637babaa7338f8491f00b4b7439c96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 d9ede859f98db83d88ebb375ffe9b8cec8922a4dfe9d4f46b70dfe761b1ce932
MD5 6785504e07d2b1dd23906feba8574d71
BLAKE2b-256 1ee2b2628f2c7fb1249328e2b336b19a5778a22a4d96094f1a9b1b1421cbd285

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 34245920e827336b46e2d99a1300711ac581c75dd907fb57aaf85aa558e0ca53
MD5 4f9f68635a7b7018d013d87606f28728
BLAKE2b-256 e69bfb93770dfe2e6875994cce0d045df6e86559105964515c9e0ae44628e5ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 120fb3d52e73cf9f43439dc1a90beaa35c3ee0870d5001cc7a3e602f9ebc0405
MD5 20cb31d2360b82735e0245c065aed9d6
BLAKE2b-256 37b47466d6a2c6f2814d26e1efb6b49191a2e8f38836b9d26352704afe13d6f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 364007f42253b76f55971013b8940b149ff7f88110a34cf78da50170ced08f4d
MD5 4e9a7f198539da94cce14129f03fce57
BLAKE2b-256 b3a24f446a20b6d1b592417dd41d3e3b771aeb873417cff3abdbb526127d9151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d4fd7f7a031ecc68c5166bcb378ddb4707e3241c3a935bda197d9fd36a52df6
MD5 7e1babae222c63254b5160a7fea25414
BLAKE2b-256 98beb433b0739398b2ebd67cca18acd9c49d408a6bed2ee3bbea635bc88e8ff8

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