Skip to main content

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.

Requires Python 3.11 or newer.

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.

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"}
        )

Runtime metrics

Enable PyNominalStreamOpts(track_metrics=True) (or pass track_metrics=True to NominalDatasetStream.create) to emit dictionary enqueue staleness and Core request latency metrics. Metrics are disabled by default.

NumPy batches

NumPy is optional: install nominal-streaming[numpy], or use the NumPy installation already provided by your application. Pass arrays directly to enqueue_batch:

import numpy as np

timestamps = np.array([1_700_000_000_000_000_000, 1_700_000_000_000_000_001], dtype="uint64")
values = np.array([1.25, 2.5], dtype="float64")
stream.enqueue_batch("temperature", timestamps, values)

Native-endian, aligned, one-dimensional NumPy arrays are copied into Rust-owned memory without creating a Python object for every element. The fast path supports int64/uint64 timestamps and float32/float64/int64/uint64 values, including strided, reversed, and read-only views. Integer values retain the API's existing conversion to doubles. Inputs can be changed or freed after the call returns.

Other dtypes, unaligned or non-native-endian arrays, and ndarray subclasses use the existing element-wise conversion. Masked values and datetime/timedelta values still require explicit conversion. Lists and tuples continue to work without NumPy.

Building and testing wheels

All builds use the Python 3.11 stable ABI (cp311-abi3) with native NumPy buffer support. Build a wheel with the standard workspace command:

uv build --package nominal-streaming

NumPy is never needed to import the library or use lists. CI shares one wheel across parallel Python 3.11 through 3.15 jobs. Each job exercises lists without NumPy, then runs the batch regression tests and type checks with the locked test dependencies. To run tests locally with the test dependency group:

uv run --group test python -m unittest discover -s py-nominal-streaming/tests -v

Measuring enqueue performance

With a wheel and the test dependencies installed:

python py-nominal-streaming/benchmarks/enqueue_batch.py

This compares direct arrays, pre-existing lists, and .tolist() plus the enqueue call. It reports all samples and medians and reads the local Avro output to verify point counts and value checksums. It measures the complete public enqueue call with buffer capacity available; startup and draining are excluded. It does not measure network throughput. Downstream serialization, compression, and upload backpressure can limit the overall streaming improvement.

Metadata

Release files for nominal-streaming 0.10.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for nominal-streaming 0.10.4
File
nominal_streaming-0.10.4-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_armv7l.whl CPython 3.11 abi3 Linux musl 1.2+ ARMv7l Details
nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details
nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.11 abi3 Linux glibc 2.17+ ARMv7l Details
nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
nominal_streaming-0.10.4-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 30.7 MB

Release files / nominal_streaming-0.10.4-cp311-abi3-win_amd64.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-win_amd64.whl
Size 4.2 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4d75a9f32a992715c4663a8b50fe6782fed6dddc231d78fa095af21a02f725da
BLAKE2b-256 checksum
How to use checksums
d453a13acaaad60420b64e21c741b4ab870a37d9aa855699145e1950e5dcdb79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_x86_64.whl
Size 4.1 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3f052f8951a291dac5e535e71a91dc3227cff0a42f06ad7d11a218dad4410e50
BLAKE2b-256 checksum
How to use checksums
1b3907bd4c4cf92a4be7c5c54e4bc08f79322cf687b97307ec383fa6bdeebb66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_armv7l.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_armv7l.whl
Size 3.7 MB
Tags CPython 3.11 Linux musl 1.2+ ARMv7l abi3
SHA-256 checksum
How to use checksums
5885c9e12688874e45dbb3af49c0e5eca75aa972740b6a2ce49b9ff753654bcc
BLAKE2b-256 checksum
How to use checksums
895e00473a70af3a5e2d423a8556fdb7b7bc8ddcb3740a5e82c4d461cfcf99a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-musllinux_1_2_aarch64.whl
Size 3.9 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
d47bfb62b23b14c3ab8977552c19b20fd977324166c9efa18b0e3fc6550fb4f5
BLAKE2b-256 checksum
How to use checksums
2031093d8c1fbd66487eabfd1d50cbb38f317dd3e0b34795d0c436a8df670c6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
79defbb9b603d798c5f802da4f4bbc11770b0abb6cdef023672748476999d9d3
BLAKE2b-256 checksum
How to use checksums
969a7d52cd93ca47dc72a14fb5787c4acf75d4719782efc1ed53d2446e698cb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 3.5 MB
Tags CPython 3.11 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
dcb30aab5b99ab161d3da66f80f8e6cabc9ad2deb0075c79086eb80248d393d3
BLAKE2b-256 checksum
How to use checksums
3ca2896febca4472550c9b04cf98a04b78fc489458637a7a7dec9cc87ce1d34f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
30a9c39dd9316ef680b9d77d3d9b889d4a6540fed56ef83a490909aa541d456c
BLAKE2b-256 checksum
How to use checksums
b2dae45dcc4f2d9ab306b37f1ed57eb903e53cfffe32795a7b9691158639b67e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release files / nominal_streaming-0.10.4-cp311-abi3-macosx_11_0_arm64.whl

Download URL nominal_streaming-0.10.4-cp311-abi3-macosx_11_0_arm64.whl
Size 3.7 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
acb3d3d89eb47e31e24230b603d625bac0a4ba02b89340177c7c193452763ad1
BLAKE2b-256 checksum
How to use checksums
c44813f24fd4ea72d26782c894438931dbab9f13c4b875668d5761377301b609
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.24

Release history Release notifications | RSS feed

This release

0.10.4 This release

8 release files

0.10.3

8 release files

0.10.0

8 release files

0.9.10

8 release files

0.9.9

8 release files

0.9.8

7 release files

0.9.7

8 release files

0.9.6

8 release files

0.9.5

8 release files

0.9.4

8 release files

0.9.3

8 release files

0.9.2

8 release files

0.9.1

8 release files

0.9.0

8 release files

0.8.2

8 release files

0.8.1

8 release files

0.8.0

8 release files

0.7.11

8 release files

0.7.10

8 release files

0.7.9

8 release files

0.7.8

8 release files

0.7.7

8 release files

0.7.6

8 release files

0.7.5

8 release files

0.7.4

8 release files

0.7.3

7 release files

0.7.2

7 release files

0.7.1

7 release files

0.7.0

7 release files

0.6.0

7 release files

0.5.8

7 release files

0.5.7

7 release files

0.5.6

7 release files

0.5.5

7 release files

0.5.4

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page