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:
- Data should exist in-memory only for a limited, configurable amount of time before it's sent to Core.
- Writes should fall back to disk if there are network failures.
- 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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 30.7 MB
Release files / nominal_streaming-0.10.3-cp311-abi3-win_amd64.whl
| Download URL | nominal_streaming-0.10.3-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d0054b191e23614d434ddd23486227f0fba9ebc94525b241e765a7bd8b960809
|
|
BLAKE2b-256 checksum How to use checksums |
65a9258504b836ce8068c61ac344bcafb85edac279b5279eb4d65ccacfd11b0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | nominal_streaming-0.10.3-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 |
5578ac054bcf44ce3b2e6582fc482ebd80c2e590bfdf8db080726d30ba3aff23
|
|
BLAKE2b-256 checksum How to use checksums |
b04e4d06becf1f5abacfb07c3792d6c1ef46a0d35ba5b62b12b4cffe6b2ca822
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-musllinux_1_2_armv7l.whl
| Download URL | nominal_streaming-0.10.3-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 |
4f469fb1e3676e6bd3d5ce1ebe2f926725da110f38972c7d6f368547e33339fc
|
|
BLAKE2b-256 checksum How to use checksums |
f38de020873dfd62f1c9fa55518c7a6e44bfd767b75ed4371711465936477ae4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | nominal_streaming-0.10.3-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 |
7173d0673b1b22bd55e5c1701a26a3717c540584b4b7abe7d347da2444f552fb
|
|
BLAKE2b-256 checksum How to use checksums |
8f1a6c2012b1c1485fbeb31ac194b2fa79fef49321fd3c0c3704a3b50ea2bb08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | nominal_streaming-0.10.3-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 |
5701a84828db8d35893de44ac7a83208a4faaae8dd37c969932d181a9190c3b7
|
|
BLAKE2b-256 checksum How to use checksums |
c49f4efb93c864d5a03e21ae832fe34de2f021683d13576aa1888cd40562feb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | nominal_streaming-0.10.3-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 |
f20e02b480cd8c4867ef917a09ab6e1d44c34443214aa7445cf027f15023bb4a
|
|
BLAKE2b-256 checksum How to use checksums |
cf77732bf62a4744210727605cac54b4fa775a420d4da92ae5af4658de1d8979
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | nominal_streaming-0.10.3-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 |
db987099a107f5fc012dd973aa09769cda8ab3c07a671897d416dc745b267a08
|
|
BLAKE2b-256 checksum How to use checksums |
ab5d4fdf0cf2540e68391ea406de2e29e367cd506f2269428a327092fa9b5f26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.3-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | nominal_streaming-0.10.3-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 |
ce357d55d0d07b8c26d65fd1c8da0cd0af481359f0f38d31c485a0f666719b9f
|
|
BLAKE2b-256 checksum How to use checksums |
28a70a0db75e605b40a4c5edf3b5a0abdba8d6cc15943dad6f932d0ceb552888
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|