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

Uploaded CPython 3.10+Windows x86-64

nominal_streaming-0.7.11-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.11-cp310-abi3-musllinux_1_2_armv7l.whl (3.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

nominal_streaming-0.7.11-cp310-abi3-musllinux_1_2_aarch64.whl (3.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

nominal_streaming-0.7.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

nominal_streaming-0.7.11-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.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

nominal_streaming-0.7.11-cp310-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file nominal_streaming-0.7.11-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fa887a7e3d6e612db21aaf2a682560ce83a1fe2d0184b52cb15752a6c7501fe7
MD5 62e5d14bfcb0e1f8a937028b2b17bd2d
BLAKE2b-256 d0e7d5a8d115d08182d762e6c5a49a865c5c0ef2a5993f63842ee59955e21220

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1bdd6c8c3f598f376298cc9451d4f7565a63272c4aa34f0d9e483e1b230ad547
MD5 f915a696c8115d1db58cd51ab750ec4c
BLAKE2b-256 ad6d85db667aaac0060103300efe2a8e21e0bc178dac9db0a9c0efcfff266a70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 630ef59a241d2ffe7c98f6d72fe58f4d9abe70726ae7584f5435f36b707c8706
MD5 4771800fce7fd4ede10313014e848a32
BLAKE2b-256 42c6c45f48bc0cd79f844bca93b200f973035ec4faf433d2e05905b3b95e3492

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b1069a90f0c1b992bafbee61a092d33a99b513b4c24587c7d3dc1164f1463fdb
MD5 964e1be7656a60709a40ae945f9bd61f
BLAKE2b-256 89dbbd29cf119c90c70389a302282d3d6902790b6357aadf60e5027a2ca8d7ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 70095255b9c878d2110e0934e1db6570e9dfe9389db784601171f56208c53d1f
MD5 a6c91ebf1d7c38dff50b9e2cda75e1be
BLAKE2b-256 0159d319bab8c0248017bdb0df5163ef1a57f328b01c6abbea8e411786491150

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 f72c0983c00b8ce2e8892c371cc7d00a2ba8b3d769e009235d5d6f0d2fcd4197
MD5 59bd8cc7f9694fc569693cda529d5258
BLAKE2b-256 2ee18dcecd87dea85e16e55b96a24e6c7e1ea119b80152309219f614dfa065af

See more details on using hashes here.

File details

Details for the file nominal_streaming-0.7.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ceb163a5a4fdafa4d014360f6d4f89ea25d5df58b3a908312b570c8188943555
MD5 5301a46a12dc93aea20d4248dd3ce9ca
BLAKE2b-256 c2b3570935d8a3ff18b872418466451ae99548ac3d21123cfc9ff8fcfc58a464

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nominal_streaming-0.7.11-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5fd9eb73dda76444467dd33867f13b0d92ed79f2f3a7802d37f9107ce83a0ac3
MD5 c823260f3252192fa7742036e57dab65
BLAKE2b-256 5f47171f703d0facd9be51ebc7388bf288c1e5f302370dfeb1464e71d4596353

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