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:
- 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)
Python 3.11+ wheels copy native-endian, aligned, one-dimensional NumPy arrays 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.
Python 3.10 wheels retain the element-wise path and emit one RuntimeWarning per
process on the first array batch. On that build, .tolist() can be faster; on an
accelerated build, pass supported arrays directly. Python 3.11+ installers prefer
the accelerated wheel when both variants are available.
Building and testing the two wheels
Both variants use the same sources and public API. Build them separately:
maturin build --release -m py-nominal-streaming/Cargo.toml --no-default-features --features python310
maturin build --release -m py-nominal-streaming/Cargo.toml --no-default-features --features python311
The output tags are cp310-abi3 and cp311-abi3, respectively. The default source
build targets Python 3.10. Cargo features are additive: enabling both selects the
older ABI and disables buffer acceleration, so use --no-default-features for the
Python 3.11 variant. NumPy is never needed to import the library or use lists.
CI installs each built wheel in a clean environment, checks its compiled
capability, exercises lists without NumPy, and runs the batch regression tests with
NumPy on the minimum and newer Python runtimes. To run tests locally after installing
a wheel and the test dependency group:
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 61.2 MB
Release files / nominal_streaming-0.10.1-cp311-abi3-win_amd64.whl
| Download URL | nominal_streaming-0.10.1-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d51520f9b5884fd3a9e674d4409f06a1d8982b3ca4c1c4e8837456937548e150
|
|
BLAKE2b-256 checksum How to use checksums |
774a9925a980d9b4ea4b4a2ee21d5c4aea805c9b6c151166fcafb3d1b0fa1357
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | nominal_streaming-0.10.1-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 |
19912f09c2fa2c375dc90a250ffb797829da3e929d46cb13b847c8dcf00abd8b
|
|
BLAKE2b-256 checksum How to use checksums |
9a202c2e18fb3e74c1194003f5782fe0ef15e518b623e6ef8fa579f7b78031df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-musllinux_1_2_armv7l.whl
| Download URL | nominal_streaming-0.10.1-cp311-abi3-musllinux_1_2_armv7l.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
b7d07831341a2b7054e66c1918d402ae2801a5abf0d7ffcd68c485a396f00057
|
|
BLAKE2b-256 checksum How to use checksums |
d2e11e268b24cd16628ebac9da72ecd7ffc68aacab5135dafba9662058215200
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | nominal_streaming-0.10.1-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 |
053318b6339e03b6a4ed1cc2a4ba60c88c82ae25480e05b8c275f70ca6464928
|
|
BLAKE2b-256 checksum How to use checksums |
5e68f888bf2c6a3323d3cf9b63cfce9aa65080217ed4f24cc36f5bb95e1a5338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | nominal_streaming-0.10.1-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 |
f8b3fa984e9791df3918fad9f040791ce6e6d21fb4d6ccb288bd9bd14a2d1c31
|
|
BLAKE2b-256 checksum How to use checksums |
5630dbed10001ed18017042276e5463cdec616f1c5559b843cd2bcec79ddfb85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | nominal_streaming-0.10.1-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 |
c2dcacab492082b16c717c2140d313dba5f747093d3a90f07c7ace8154d2cf25
|
|
BLAKE2b-256 checksum How to use checksums |
e3b9c61beb2b2f31cbcd6015958198988e2f94ab245dd51db73d343a53dfa560
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | nominal_streaming-0.10.1-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 |
8238dc98a47c3afee1e3d6b3b9c5d841e371f8dae49b53ae72d9bd13bb780e56
|
|
BLAKE2b-256 checksum How to use checksums |
a8570deabdd0657176df5b2f3c670ede5562a2532c45a97bc9d4cdd9c794bea2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | nominal_streaming-0.10.1-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 |
06423e22bca23b6d7c80bb17b6943e1543feb5c7c781ea197cc3d0330d8fe144
|
|
BLAKE2b-256 checksum How to use checksums |
6d92cb2d73d789b2ed25c2e32cb761f6d3d5a28bb380116bcec140db167f13c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-win_amd64.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
55da26aa9b053e125b02b548b3493b6886bb2f76a912f2bc9f8c5c82d9918e77
|
|
BLAKE2b-256 checksum How to use checksums |
5c92709bd0947460541af5d980f147ac6393cc1b37630b1ac43507e09592419a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
313037a85876116ad17ab019db477623b6ae0a7495c60800eb2d230dbc00abe2
|
|
BLAKE2b-256 checksum How to use checksums |
95fa9d17c1e4d8e3f9c83edc82439363e596c692eb5d3171ce6408e391b82712
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-musllinux_1_2_armv7l.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-musllinux_1_2_armv7l.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
a4b67242fd02683be1e08cba1d56bf7cc9d95f408697deac50f31625373a4732
|
|
BLAKE2b-256 checksum How to use checksums |
51c79b05be96961401e2785898da6253baed82a3ac1dc87b92415b60519470fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
056161520a7d36039f794f56ca0f29602b9166161234aa9ba354efa3ff7f30fd
|
|
BLAKE2b-256 checksum How to use checksums |
3aaca501f57feb85fd0398024a187a1b27c24ae54fe1a264b38307e21cb6d959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
718a762ea019214d17be3afcf05fd247d84cf264717a2254c311f75e780d649b
|
|
BLAKE2b-256 checksum How to use checksums |
c80b2043f858db36e24b19849f14b187308f9ab5729ab6021c364eb0ded5d0b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
a782a12783055af3c2efdff617a9fe0ff2f7553df113797dbb0123fd6a2924d1
|
|
BLAKE2b-256 checksum How to use checksums |
53c79388db2c3bac078fefc360e6ade4fc4cffce0a37c102b91f7ec5bd2313a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b6aadab1129ad9d8f907fbeb0de5b28bbd30a170e536968409fef5a334ac41cb
|
|
BLAKE2b-256 checksum How to use checksums |
b578de27b05c338626d1d54e7de5f9f5cd16c5f3eace356219b6b4c31a9eafa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|
Release files / nominal_streaming-0.10.1-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | nominal_streaming-0.10.1-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fd081dd4c338911f3a8d9d74d7228778baf552b35cd5ad75538e768af43b7131
|
|
BLAKE2b-256 checksum How to use checksums |
edd9205c309598cb9e444bf8585deb1e9b81d660dfc5a9de8f76dd8aadaa4d57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.24
|