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

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.5.6-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.6-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.6-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.6-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.6-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.6-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.6-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 014d05b0c2f2c828a438b156b67141174007056e2a12362b34f2541cad5f4804
MD5 dda8d16254ff68e8bb56c23dbfabf383
BLAKE2b-256 07e825c4000b086c7955a7bc3a415a3e76aa891d9c9344bf758c0a37209d8b21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 202fa131e6a90234676bfcc07366d95da122bf781331ecee0be730a6d3ffd680
MD5 17f8f4d03925358392f839bd983b46ea
BLAKE2b-256 f1b9d87e7c02803e2418609a0b40058d589dfb8d4e2066ddc82082d082efa32d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 d34cf94eb7585682d2a6747056da9433fab941492783081c282cd0aaa4195e31
MD5 64232386f2e7b897634bc142329ae4ca
BLAKE2b-256 afb359cb12b6359f8d70a5c225fa99c841c74cdf0e70410f3dbdc7ecf7e9754f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a688f869275bf1e3fdcd1060673b30efc85b1a468347886cce4abc17c9f01be6
MD5 76b6b1b3a4e9f10046abdd18557307d2
BLAKE2b-256 5f542824aa4848dc004e53ac9e8894c93565a27329caf1d80efe219493561352

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f402b01981427bad0364c3be5f61678a591c697c2077aaae54c6e2cff80f570
MD5 8ab268c0986d309cc8f2448e4eeb1f28
BLAKE2b-256 3d827a3e10adeebab17f2a6a968adfdfc785a36bcc5ae5e12d3c097ed81514af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 3763ef04f10d56eb1c4fa0fd9bf9aceaea8f9d3c0fc89c2c19e8e8b7c082cf14
MD5 5ec0973383b3f479a99a9530ef1cbae1
BLAKE2b-256 10c8332036b93c195df274bff4de4f4e19a713c24ba6ce4ad132e8261cd69140

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.5.6-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1922d60f5c93a741fe90d35d48de216368bcc78d8ee8721a3bc5eaa1d19cdbd
MD5 85475d256638056c7092e0c5f92660e8
BLAKE2b-256 658f2392c3680f56275dd94e6e7c2d9996b2c46336a39ea5aae7bfc210fea326

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