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

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.5.8-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.8-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.8-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.8-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.8-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.8-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.8-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 88530a72c3feba22a2ccaa8cd8f3ebc18dfd52b6c80420c0bdc6369c1cb4fe86
MD5 e8cf41b84b5d4926565cc9055fc4c33a
BLAKE2b-256 c1d17c91bc5b0d4f0c889af6371d0aeb0986fba88f48e74d36a0c6735bb1750c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a8e114f40367b7578aff58bbae9419956e319d6db29883e7bc349ca06b5a49b5
MD5 1947344c8868f9aef1bed99b5f80aed4
BLAKE2b-256 def0dd81f920ec57c8ec8273f184c355bc037e681cc79fd93e0f41efa33c0eb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 9d1eabc6ed1bfc0d185e48da5d8bba591a378ffe21f45df18b57f842649283a0
MD5 5717c18fdc48ee3c30989e117a45f16b
BLAKE2b-256 09f5d526ea78898dc9a3c409e7089d17152bec1269bfd19d9f2e47041e655ef5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0a268f02c6ae4c8a4d26f39b9d831f22f4e43be9fb757e0c57cb43199b756345
MD5 f675031605a28977f2194949e0e8919f
BLAKE2b-256 9fd26cb798094cc3e887336d8c201043f4e9336661e353b8fbc01643deacdd29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dedfc6989e1e3388764305310ec2b1a3c0069e78c0107c41b31b871ed7989a3f
MD5 9b10fa8d9f17b9808e3ffb9ea26c0ca6
BLAKE2b-256 2d1eb902c914b281256c94ac572374e523e8c8f34916d5fd519cb8a2a56bd0eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 cefa65f067153774d13db9b78d128a3f87b43d956fc9dd377295ad7919b51f0a
MD5 fcded132f25fbf8f5a17dd04731ba554
BLAKE2b-256 bc9cb132a593661d6af6b9795132c628c81644a7495767664d2dbac2fdea1f18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.8-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ecc5fe6beda872df9ffefb2ee053d3eb28847fdea7a845a130de66b5a9d8659
MD5 843bb0a0fd27d3db458287fdd823c376
BLAKE2b-256 47d25ae27b2c0caeef6da98b896a6364669cb0d29c4f30119571326d4878dc9f

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