nominal-streaming 0.5.7__cp310-abi3-musllinux_1_2_aarch64.whl → 0.7.5__cp310-abi3-musllinux_1_2_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,8 @@ import pathlib
4
4
  from types import TracebackType
5
5
  from typing import Sequence, Type
6
6
 
7
+ from typing_extensions import Self
8
+
7
9
  from nominal_streaming.nominal_dataset_stream import DataType
8
10
 
9
11
  class PyNominalStreamOpts:
@@ -108,7 +110,7 @@ class PyNominalStreamOpts:
108
110
  True
109
111
  """
110
112
 
111
- def with_max_points_per_batch(self, n: int) -> PyNominalStreamOpts:
113
+ def with_max_points_per_batch(self, n: int) -> Self:
112
114
  """Set the maximum number of points per record.
113
115
 
114
116
  Args:
@@ -121,7 +123,7 @@ class PyNominalStreamOpts:
121
123
  >>> opts = PyNominalStreamOpts.default().with_max_points_per_batch(1000)
122
124
  """
123
125
 
124
- def with_max_request_delay_secs(self, delay_secs: float) -> PyNominalStreamOpts:
126
+ def with_max_request_delay_secs(self, delay_secs: float) -> Self:
125
127
  """Set the maximum delay before forcing a request flush.
126
128
 
127
129
  Args:
@@ -134,7 +136,7 @@ class PyNominalStreamOpts:
134
136
  >>> opts = PyNominalStreamOpts.default().with_max_request_delay_secs(1.0)
135
137
  """
136
138
 
137
- def with_max_buffered_requests(self, n: int) -> PyNominalStreamOpts:
139
+ def with_max_buffered_requests(self, n: int) -> Self:
138
140
  """Set the maximum number of requests that can be buffered concurrently.
139
141
 
140
142
  Args:
@@ -147,7 +149,7 @@ class PyNominalStreamOpts:
147
149
  >>> opts = PyNominalStreamOpts.default().with_max_buffered_requests(200)
148
150
  """
149
151
 
150
- def with_num_upload_workers(self, n: int) -> PyNominalStreamOpts:
152
+ def with_num_upload_workers(self, n: int) -> Self:
151
153
  """Set the number of asynchronous dispatcher tasks.
152
154
 
153
155
  Args:
@@ -160,7 +162,7 @@ class PyNominalStreamOpts:
160
162
  >>> opts = PyNominalStreamOpts.default().with_num_upload_workers(8)
161
163
  """
162
164
 
163
- def with_num_runtime_workers(self, n: int) -> PyNominalStreamOpts:
165
+ def with_num_runtime_workers(self, n: int) -> Self:
164
166
  """Set the number of runtime worker threads.
165
167
 
166
168
  Args:
@@ -173,7 +175,7 @@ class PyNominalStreamOpts:
173
175
  >>> opts = PyNominalStreamOpts.default().with_num_runtime_workers(16)
174
176
  """
175
177
 
176
- def with_api_base_url(self, url: str) -> PyNominalStreamOpts:
178
+ def with_api_base_url(self, url: str) -> Self:
177
179
  """Set the base URL for the Nominal API.
178
180
 
179
181
  Args:
@@ -211,7 +213,7 @@ class PyNominalDatasetStream:
211
213
  >>> stream = PyNominalDatasetStream(PyNominalStreamOpts())
212
214
  """
213
215
 
214
- def enable_logging(self, log_directive: str | None = None) -> PyNominalDatasetStream:
216
+ def enable_logging(self, log_directive: str | None = None) -> Self:
215
217
  """Enable client-side logging for diagnostics.
216
218
 
217
219
  NOTE: must be applied before calling open()
@@ -225,7 +227,7 @@ class PyNominalDatasetStream:
225
227
  The updated instance for fluent chaining.
226
228
  """
227
229
 
228
- def with_options(self, opts: PyNominalStreamOpts) -> PyNominalDatasetStream:
230
+ def with_options(self, opts: PyNominalStreamOpts) -> Self:
229
231
  """Attach or replace stream options.
230
232
 
231
233
  NOTE: must be applied before calling open()
@@ -241,7 +243,7 @@ class PyNominalDatasetStream:
241
243
  self,
242
244
  dataset_rid: str,
243
245
  token: str | None = None,
244
- ) -> PyNominalDatasetStream:
246
+ ) -> Self:
245
247
  """Send data to a Dataset in Nominal.
246
248
 
247
249
  NOTE: Must be applied before calling open()
@@ -259,7 +261,7 @@ class PyNominalDatasetStream:
259
261
  RuntimeError: If called after `to_file`.
260
262
  """
261
263
 
262
- def to_file(self, path: pathlib.Path) -> PyNominalDatasetStream:
264
+ def to_file(self, path: pathlib.Path) -> Self:
263
265
  """Write points to a local file (newline-delimited records).
264
266
 
265
267
  Mutually exclusive with `with_core_consumer`.
@@ -274,7 +276,7 @@ class PyNominalDatasetStream:
274
276
  RuntimeError: If already configured for core consumption.
275
277
  """
276
278
 
277
- def with_file_fallback(self, path: pathlib.Path) -> PyNominalDatasetStream:
279
+ def with_file_fallback(self, path: pathlib.Path) -> Self:
278
280
  """If sending to core fails, fall back to writing to `path`.
279
281
 
280
282
  NOTE: Requires that `with_core_consumer` has been configured.
@@ -371,7 +373,7 @@ class PyNominalDatasetStream:
371
373
  TypeError: If any value is not an `int`, `float`, or `str`.
372
374
  """
373
375
 
374
- def __enter__(self) -> PyNominalDatasetStream: ...
376
+ def __enter__(self) -> Self: ...
375
377
  def __exit__(
376
378
  self, exc_type: Type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
377
379
  ) -> None: ...
@@ -38,6 +38,7 @@ from types import TracebackType
38
38
  from typing import Mapping, Sequence, Type
39
39
 
40
40
  import dateutil
41
+ from typing_extensions import Self
41
42
 
42
43
  from nominal_streaming._nominal_streaming import (
43
44
  PyNominalDatasetStream,
@@ -88,7 +89,7 @@ class NominalDatasetStream:
88
89
  max_buffered_requests: int = 4,
89
90
  num_upload_workers: int = 8,
90
91
  num_runtime_workers: int = 8,
91
- ) -> NominalDatasetStream:
92
+ ) -> Self:
92
93
  """Factory constructor to build a NominalDatasetStream using optional overrides for configuration options
93
94
 
94
95
  Args:
@@ -117,7 +118,7 @@ class NominalDatasetStream:
117
118
  )
118
119
  return cls(auth_header, opts)
119
120
 
120
- def enable_logging(self, log_directive: str = "debug") -> NominalDatasetStream:
121
+ def enable_logging(self, log_directive: str = "debug") -> Self:
121
122
  """Enable logging with the given verbosity level
122
123
 
123
124
  Args:
@@ -128,7 +129,7 @@ class NominalDatasetStream:
128
129
  self._impl = self._impl.enable_logging(log_directive)
129
130
  return self
130
131
 
131
- def with_core_consumer(self, dataset_rid: str) -> NominalDatasetStream:
132
+ def with_core_consumer(self, dataset_rid: str) -> Self:
132
133
  """Enables streaming to a Dataset in Core
133
134
 
134
135
  Args:
@@ -137,7 +138,7 @@ class NominalDatasetStream:
137
138
  self._impl = self._impl.with_core_consumer(dataset_rid, self._auth_header)
138
139
  return self
139
140
 
140
- def to_file(self, path: pathlib.Path) -> NominalDatasetStream:
141
+ def to_file(self, path: pathlib.Path) -> Self:
141
142
  """Target streaming towards a local `.avro` file
142
143
 
143
144
  The written file will contain snappy-compressed avro data. This can be read as follows:
@@ -156,7 +157,7 @@ class NominalDatasetStream:
156
157
  self._impl = self._impl.to_file(path)
157
158
  return self
158
159
 
159
- def with_file_fallback(self, path: pathlib.Path) -> NominalDatasetStream:
160
+ def with_file_fallback(self, path: pathlib.Path) -> Self:
160
161
  """Setup file fallback for streaming to core
161
162
 
162
163
  The written file will contain snappy-compressed avro data for any batches of data that were unable to make
@@ -176,7 +177,7 @@ class NominalDatasetStream:
176
177
  self._impl = self._impl.with_file_fallback(path)
177
178
  return self
178
179
 
179
- def open(self) -> NominalDatasetStream:
180
+ def open(self) -> Self:
180
181
  """Create the stream as a context manager.
181
182
 
182
183
  NOTE: installs a sigint handler to enable more graceful shutdown.
@@ -201,7 +202,7 @@ class NominalDatasetStream:
201
202
  signal.signal(signal.SIGINT, _on_sigint)
202
203
  return self
203
204
 
204
- def __enter__(self) -> NominalDatasetStream:
205
+ def __enter__(self) -> Self:
205
206
  """Create the stream as a context manager.
206
207
 
207
208
  NOTE: installs a sigint handler to enable more graceful shutdown.
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nominal-streaming
3
- Version: 0.5.7
3
+ Version: 0.7.5
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: License :: OSI Approved :: MIT License
7
7
  Classifier: Operating System :: OS Independent
8
+ Requires-Dist: typing-extensions>=4,<5
8
9
  Requires-Dist: python-dateutil>=0.0.0
9
10
  Summary: Python bindings for the Nominal Rust streaming client
10
11
  License: MIT
@@ -29,7 +30,7 @@ It also provides configuration to manage the tradeoff between above listed conce
29
30
  > [!WARNING]
30
31
  > This library is still under active development and may make breaking changes.
31
32
 
32
- ## Simple usage example: streaming from memory to Nominal Core with file fallback
33
+ ## Usage example: streaming from memory to Nominal Core with file fallback
33
34
 
34
35
  ```python
35
36
  import pathlib
@@ -42,7 +43,7 @@ if __name__ == "__main__":
42
43
  num_points = 100_000
43
44
  stream = (
44
45
  NominalDatasetStream(
45
- auth_header="<api key>",
46
+ auth_header="<api key>",
46
47
  opts=PyNominalStreamOpts(),
47
48
  )
48
49
  .enable_logging("info") # can set debug, warn, etc.
@@ -56,18 +57,17 @@ if __name__ == "__main__":
56
57
  time_ns = int(time.time() * 1e9)
57
58
  value = (idx % 50) + 0.5
58
59
  stream.enqueue("channel_name", time_ns, value, tags={"tag_key": "tag_value"})
59
-
60
+
60
61
  # Stream 100_000 points in one batch
61
62
  start_time = int(time.time() * 1e9)
62
63
  timestamp_offsets = int(1e9 / 1600)
63
64
  timestamps = [start_time + timestamp_offsets * idx for idx in range(num_points)]
64
65
  values = [(idx % 50) + 0.5 for idx in range(num_points)]
65
66
  stream.enqueue_batch(
66
- "channel_name",
67
- timestamps,
68
- values,
67
+ "channel_name",
68
+ timestamps,
69
+ values,
69
70
  tags={"tag_key": "tag_value"}
70
71
  )
71
-
72
72
  ```
73
73
 
@@ -0,0 +1,9 @@
1
+ nominal_streaming-0.7.5.dist-info/METADATA,sha256=-VAuBpQmXYwBXhdYcqQ0mBaHzo4JLcBZPClyKl0Sn58,2814
2
+ nominal_streaming-0.7.5.dist-info/WHEEL,sha256=EYTFw83l-1Egr0yK8_y3A2oK6lLpVyAvyCNXIbM92ys,107
3
+ nominal_streaming.libs/libgcc_s-39080030.so.1,sha256=fIO6GHOh8Ft9CR0Geu7wSUb9Xnl122iTtrxQQ9TAkTQ,789673
4
+ nominal_streaming/__init__.py,sha256=7isEI7NFTEnTNEmxjtDgehQQPPRM-ByrH903VBWrulQ,202
5
+ nominal_streaming/_nominal_streaming.abi3.so,sha256=e8HEO8_eRgxsM1ICfXsFx_zvdPg0-3I_nIgIq7L-Bno,7867937
6
+ nominal_streaming/_nominal_streaming.pyi,sha256=hZ5TpAFFMZzajSu13yh-klEh81ItvF5C5f_3i0rMfkM,12093
7
+ nominal_streaming/nominal_dataset_stream.py,sha256=0OXLiGDhyT9Q4z0QJlXaV7H3Nd3OWMPi2bjQJKcM5eE,11507
8
+ nominal_streaming/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ nominal_streaming-0.7.5.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- nominal_streaming-0.5.7.dist-info/METADATA,sha256=gXg2ftUuJbNasPY71BdJAyk-udzthfGz3wn8gpcauvM,2795
2
- nominal_streaming-0.5.7.dist-info/WHEEL,sha256=EYTFw83l-1Egr0yK8_y3A2oK6lLpVyAvyCNXIbM92ys,107
3
- nominal_streaming.libs/libgcc_s-39080030.so.1,sha256=fIO6GHOh8Ft9CR0Geu7wSUb9Xnl122iTtrxQQ9TAkTQ,789673
4
- nominal_streaming/__init__.py,sha256=7isEI7NFTEnTNEmxjtDgehQQPPRM-ByrH903VBWrulQ,202
5
- nominal_streaming/_nominal_streaming.abi3.so,sha256=a_xRIgTFY6IStnV_w5jgr1saRq5FIhjlJ7q9ZZUugNE,8064505
6
- nominal_streaming/_nominal_streaming.pyi,sha256=iWvKG8baZ7kZpDWOzvIigHEl9fg18cA6DIh4ch-y03Y,12255
7
- nominal_streaming/nominal_dataset_stream.py,sha256=bldR0-7aFU05MXn0adwKuAWEQVE4EiBQ2FuKXJMc7mw,11584
8
- nominal_streaming/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- nominal_streaming-0.5.7.dist-info/RECORD,,