foxglove-sdk 0.6.2__cp312-cp312-win32.whl → 0.16.6__cp312-cp312-win32.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.
@@ -1,297 +1,394 @@
1
- from collections.abc import Callable
2
- from enum import Enum
3
- from typing import List, Optional, Union
4
-
5
- import foxglove
6
-
7
- class Capability(Enum):
8
- """
9
- An enumeration of capabilities that the websocket server can advertise to its clients.
10
- """
11
-
12
- ClientPublish = ...
13
- """Allow clients to advertise channels to send data messages to the server."""
14
-
15
- Connectiongraph = ...
16
- """Allow clients to subscribe and make connection graph updates"""
17
-
18
- Parameters = ...
19
- """Allow clients to get & set parameters."""
20
-
21
- Services = ...
22
- """Allow clients to call services."""
23
-
24
- Time = ...
25
- """Inform clients about the latest server time."""
26
-
27
- class Client:
28
- """
29
- A client that is connected to a running websocket server.
30
- """
31
-
32
- id: int = ...
33
-
34
- class ChannelView:
35
- """
36
- Information about a channel.
37
- """
38
-
39
- id: int = ...
40
- topic: str = ...
41
-
42
- class ClientChannel:
43
- """
44
- Information about a channel advertised by a client.
45
- """
46
-
47
- id: int = ...
48
- topic: str = ...
49
- encoding: str = ...
50
- schema_name: str = ...
51
- schema_encoding: Optional[str] = ...
52
- schema: Optional[bytes] = ...
53
-
54
- class ConnectionGraph:
55
- """
56
- A graph of connections between clients.
57
- """
58
-
59
- def __new__(cls) -> "ConnectionGraph": ...
60
- def set_published_topic(self, topic: str, publisher_ids: List[str]) -> None:
61
- """
62
- Set a published topic and its associated publisher ids. Overwrites any existing topic with
63
- the same name.
64
-
65
- :param topic: The topic name.
66
- :param publisher_ids: The set of publisher ids.
67
- """
68
- ...
69
-
70
- def set_subscribed_topic(self, topic: str, subscriber_ids: List[str]) -> None:
71
- """
72
- Set a subscribed topic and its associated subscriber ids. Overwrites any existing topic with
73
- the same name.
74
-
75
- :param topic: The topic name.
76
- :param subscriber_ids: The set of subscriber ids.
77
- """
78
- ...
79
-
80
- def set_advertised_service(self, service: str, provider_ids: List[str]) -> None:
81
- """
82
- Set an advertised service and its associated provider ids Overwrites any existing service
83
- with the same name.
84
-
85
- :param service: The service name.
86
- :param provider_ids: The set of provider ids.
87
- """
88
- ...
89
-
90
- class MessageSchema:
91
- """
92
- A service request or response schema.
93
- """
94
-
95
- encoding: str
96
- schema: "foxglove.Schema"
97
-
98
- def __new__(
99
- cls,
100
- *,
101
- encoding: str,
102
- schema: "foxglove.Schema",
103
- ) -> "MessageSchema": ...
104
-
105
- class Parameter:
106
- """
107
- A parameter.
108
- """
109
-
110
- name: str
111
- type: Optional["ParameterType"]
112
- value: Optional["AnyParameterValue"]
113
-
114
- def __init__(
115
- self,
116
- name: str,
117
- *,
118
- type: Optional["ParameterType"] = None,
119
- value: Optional["AnyParameterValue"] = None,
120
- ) -> None: ...
121
-
122
- class ParameterType(Enum):
123
- """
124
- The type of a parameter.
125
- """
126
-
127
- ByteArray = ...
128
- """A byte array."""
129
-
130
- Float64 = ...
131
- """A decimal or integer value that can be represented as a `float64`."""
132
-
133
- Float64Array = ...
134
- """An array of decimal or integer values that can be represented as `float64`s."""
135
-
136
- class ParameterValue:
137
- """
138
- The value of a parameter.
139
- """
140
-
141
- class Bool:
142
- """A boolean value."""
143
-
144
- def __new__(cls, value: bool) -> "ParameterValue.Bool": ...
145
-
146
- class Number:
147
- """A decimal or integer value."""
148
-
149
- def __new__(cls, value: float) -> "ParameterValue.Number": ...
150
-
151
- class Bytes:
152
- """A byte array."""
153
-
154
- def __new__(cls, value: bytes) -> "ParameterValue.Bytes": ...
155
-
156
- class Array:
157
- """An array of parameter values."""
158
-
159
- def __new__(
160
- cls, value: List["AnyParameterValue"]
161
- ) -> "ParameterValue.Array": ...
162
-
163
- class Dict:
164
- """An associative map of parameter values."""
165
-
166
- def __new__(
167
- cls, value: dict[str, "AnyParameterValue"]
168
- ) -> "ParameterValue.Dict": ...
169
-
170
- AnyParameterValue = Union[
171
- ParameterValue.Bool,
172
- ParameterValue.Number,
173
- ParameterValue.Bytes,
174
- ParameterValue.Array,
175
- ParameterValue.Dict,
176
- ]
177
-
178
- AssetHandler = Callable[[str], Optional[bytes]]
179
-
180
- class ServiceRequest:
181
- """
182
- A websocket service request.
183
- """
184
-
185
- service_name: str
186
- client_id: int
187
- call_id: int
188
- encoding: str
189
- payload: bytes
190
-
191
- ServiceHandler = Callable[["ServiceRequest"], bytes]
192
-
193
- class Service:
194
- """
195
- A websocket service.
196
- """
197
-
198
- name: str
199
- schema: "ServiceSchema"
200
- handler: "ServiceHandler"
201
-
202
- def __new__(
203
- cls,
204
- *,
205
- name: str,
206
- schema: "ServiceSchema",
207
- handler: "ServiceHandler",
208
- ) -> "Service": ...
209
-
210
- class ServiceSchema:
211
- """
212
- A websocket service schema.
213
- """
214
-
215
- name: str
216
- request: Optional["MessageSchema"]
217
- response: Optional["MessageSchema"]
218
-
219
- def __new__(
220
- cls,
221
- *,
222
- name: str,
223
- request: Optional["MessageSchema"] = None,
224
- response: Optional["MessageSchema"] = None,
225
- ) -> "ServiceSchema": ...
226
-
227
- class StatusLevel(Enum):
228
- """A level for `WebSocketServer.publish_status`"""
229
-
230
- Info = ...
231
- Warning = ...
232
- Error = ...
233
-
234
- class WebSocketServer:
235
- """
236
- A websocket server for live visualization.
237
- """
238
-
239
- def __new__(cls) -> "WebSocketServer": ...
240
- @property
241
- def port(self) -> int:
242
- """Get the port on which the server is listening."""
243
- ...
244
-
245
- def stop(self) -> None:
246
- """Explicitly stop the server."""
247
- ...
248
-
249
- def clear_session(self, session_id: Optional[str] = None) -> None:
250
- """
251
- Sets a new session ID and notifies all clients, causing them to reset their state.
252
- If no session ID is provided, generates a new one based on the current timestamp.
253
- If the server has been stopped, this has no effect.
254
- """
255
- ...
256
-
257
- def broadcast_time(self, timestamp_nanos: int) -> None:
258
- """
259
- Publishes the current server timestamp to all clients.
260
- If the server has been stopped, this has no effect.
261
- """
262
- ...
263
-
264
- def publish_parameter_values(self, parameters: List["Parameter"]) -> None:
265
- """Publishes parameter values to all subscribed clients."""
266
- ...
267
-
268
- def publish_status(
269
- self, message: str, level: "StatusLevel", id: Optional[str] = None
270
- ) -> None:
271
- """
272
- Send a status message to all clients. If the server has been stopped, this has no effect.
273
- """
274
- ...
275
-
276
- def remove_status(self, ids: list[str]) -> None:
277
- """
278
- Remove status messages by id from all clients. If the server has been stopped, this has no
279
- effect.
280
- """
281
- ...
282
-
283
- def add_services(self, services: list["Service"]) -> None:
284
- """Add services to the server."""
285
- ...
286
-
287
- def remove_services(self, names: list[str]) -> None:
288
- """Removes services that were previously advertised."""
289
- ...
290
-
291
- def publish_connection_graph(self, graph: "ConnectionGraph") -> None:
292
- """
293
- Publishes a connection graph update to all subscribed clients. An update is published to
294
- clients as a difference from the current graph to the replacement graph. When a client first
295
- subscribes to connection graph updates, it receives the current graph.
296
- """
297
- ...
1
+ from enum import Enum
2
+
3
+ from foxglove import Schema
4
+ from foxglove.websocket import (
5
+ AnyNativeParameterValue,
6
+ AnyParameterValue,
7
+ ServiceHandler,
8
+ )
9
+
10
+ class Capability(Enum):
11
+ """
12
+ An enumeration of capabilities that the websocket server can advertise to its clients.
13
+ """
14
+
15
+ ClientPublish = ...
16
+ """Allow clients to advertise channels to send data messages to the server."""
17
+
18
+ ConnectionGraph = ...
19
+ """Allow clients to subscribe and make connection graph updates"""
20
+
21
+ Parameters = ...
22
+ """Allow clients to get & set parameters."""
23
+
24
+ Services = ...
25
+ """Allow clients to call services."""
26
+
27
+ Time = ...
28
+ """Inform clients about the latest server time."""
29
+
30
+ RangedPlayback = ...
31
+ """Indicates that the server is sending data within a fixed time range."""
32
+
33
+ class Client:
34
+ """
35
+ A client that is connected to a running websocket server.
36
+ """
37
+
38
+ id: int = ...
39
+
40
+ class ChannelView:
41
+ """
42
+ Information about a channel.
43
+ """
44
+
45
+ id: int = ...
46
+ topic: str = ...
47
+
48
+ class ClientChannel:
49
+ """
50
+ Information about a channel advertised by a client.
51
+ """
52
+
53
+ id: int = ...
54
+ topic: str = ...
55
+ encoding: str = ...
56
+ schema_name: str = ...
57
+ schema_encoding: str | None = ...
58
+ schema: bytes | None = ...
59
+
60
+ class ConnectionGraph:
61
+ """
62
+ A graph of connections between clients.
63
+ """
64
+
65
+ def __init__(self) -> None: ...
66
+ def set_published_topic(self, topic: str, publisher_ids: list[str]) -> None:
67
+ """
68
+ Set a published topic and its associated publisher ids. Overwrites any existing topic with
69
+ the same name.
70
+
71
+ :param topic: The topic name.
72
+ :param publisher_ids: The set of publisher ids.
73
+ """
74
+ ...
75
+
76
+ def set_subscribed_topic(self, topic: str, subscriber_ids: list[str]) -> None:
77
+ """
78
+ Set a subscribed topic and its associated subscriber ids. Overwrites any existing topic with
79
+ the same name.
80
+
81
+ :param topic: The topic name.
82
+ :param subscriber_ids: The set of subscriber ids.
83
+ """
84
+ ...
85
+
86
+ def set_advertised_service(self, service: str, provider_ids: list[str]) -> None:
87
+ """
88
+ Set an advertised service and its associated provider ids Overwrites any existing service
89
+ with the same name.
90
+
91
+ :param service: The service name.
92
+ :param provider_ids: The set of provider ids.
93
+ """
94
+ ...
95
+
96
+ class MessageSchema:
97
+ """
98
+ A service request or response schema.
99
+ """
100
+
101
+ encoding: str
102
+ schema: Schema
103
+
104
+ def __init__(
105
+ self,
106
+ *,
107
+ encoding: str,
108
+ schema: Schema,
109
+ ) -> None: ...
110
+
111
+ class Parameter:
112
+ """
113
+ A parameter which can be sent to a client.
114
+
115
+ :param name: The parameter name.
116
+ :type name: str
117
+ :param value: Optional value, represented as a native python object, or a ParameterValue.
118
+ :type value: None|bool|int|float|str|bytes|list|dict|ParameterValue
119
+ :param type: Optional parameter type. This is automatically derived when passing a native
120
+ python object as the value.
121
+ :type type: ParameterType|None
122
+ """
123
+
124
+ name: str
125
+ type: ParameterType | None
126
+ value: AnyParameterValue | None
127
+
128
+ def __init__(
129
+ self,
130
+ name: str,
131
+ *,
132
+ value: AnyNativeParameterValue | None = None,
133
+ type: ParameterType | None = None,
134
+ ) -> None: ...
135
+ def get_value(self) -> AnyNativeParameterValue | None:
136
+ """Returns the parameter value as a native python object."""
137
+ ...
138
+
139
+ class ParameterType(Enum):
140
+ """
141
+ The type of a parameter.
142
+ """
143
+
144
+ ByteArray = ...
145
+ """A byte array."""
146
+
147
+ Float64 = ...
148
+ """A floating-point value that can be represented as a `float64`."""
149
+
150
+ Float64Array = ...
151
+ """An array of floating-point values that can be represented as `float64`s."""
152
+
153
+ class ParameterValue:
154
+ """
155
+ A parameter value.
156
+ """
157
+
158
+ class Integer:
159
+ """An integer value."""
160
+
161
+ def __init__(self, value: int) -> None: ...
162
+
163
+ class Bool:
164
+ """A boolean value."""
165
+
166
+ def __init__(self, value: bool) -> None: ...
167
+
168
+ class Float64:
169
+ """A floating-point value."""
170
+
171
+ def __init__(self, value: float) -> None: ...
172
+
173
+ class String:
174
+ """
175
+ A string value.
176
+
177
+ For parameters of type :py:attr:ParameterType.ByteArray, this is a
178
+ base64 encoding of the byte array.
179
+ """
180
+
181
+ def __init__(self, value: str) -> None: ...
182
+
183
+ class Array:
184
+ """An array of parameter values."""
185
+
186
+ def __init__(self, value: list[AnyParameterValue]) -> None: ...
187
+
188
+ class Dict:
189
+ """An associative map of parameter values."""
190
+
191
+ def __init__(self, value: dict[str, AnyParameterValue]) -> None: ...
192
+
193
+ class PlaybackCommand(Enum):
194
+ """The command for playback requested by the client player"""
195
+
196
+ Play = ...
197
+ Pause = ...
198
+
199
+ class PlaybackControlRequest:
200
+ """
201
+ A request to control playback from the client
202
+
203
+ :param playback_command: The command for playback requested by the client player
204
+ :type playback_command: PlaybackCommand
205
+ :param playback_speed: The speed of playback requested by the client player
206
+ :type playback_speed: float
207
+ :param seek_time: The time the client player is requesting to seek to, in nanoseconds. None if no seek is requested.
208
+ :type seek_time: int | None
209
+ :param request_id: Unique string identifier, used to indicate that a PlaybackState is in response to a particular request from the client.
210
+ :type request_id: str
211
+ """
212
+
213
+ playback_command: PlaybackCommand
214
+ playback_speed: float
215
+ seek_time: int | None
216
+ request_id: str
217
+
218
+ class PlaybackState:
219
+ """
220
+ The state of data playback on the server
221
+
222
+ :param status: The status of server data playback
223
+ :type status: PlaybackStatus
224
+ :param current_time: The current time of playback, in absolute nanoseconds
225
+ :type current_time: int
226
+ :param playback_speed: The speed of playback, as a factor of realtime
227
+ :type playback_speed: float
228
+ :param did_seek: Whether a seek forward or backward in time triggered this message to be emitted
229
+ :type did_seek: bool
230
+ :param request_id: If this message is being emitted in response to a PlaybackControlRequest message, the request_id from that message. Set this to an empty string if the state of playback has been changed by any other condition.
231
+ :type request_id: str | None
232
+ """
233
+
234
+ status: PlaybackStatus
235
+ current_time: int
236
+ playback_speed: float
237
+ did_seek: bool
238
+ request_id: str | None
239
+
240
+ def __init__(
241
+ self,
242
+ status: PlaybackStatus,
243
+ current_time: int,
244
+ playback_speed: float,
245
+ did_seek: bool,
246
+ request_id: str | None,
247
+ ): ...
248
+
249
+ class PlaybackStatus(Enum):
250
+ """The status of server data playback"""
251
+
252
+ Playing = ...
253
+ Paused = ...
254
+ Buffering = ...
255
+ Ended = ...
256
+
257
+ class ServiceRequest:
258
+ """
259
+ A websocket service request.
260
+ """
261
+
262
+ service_name: str
263
+ client_id: int
264
+ call_id: int
265
+ encoding: str
266
+ payload: bytes
267
+
268
+ class Service:
269
+ """
270
+ A websocket service.
271
+ """
272
+
273
+ name: str
274
+ schema: ServiceSchema
275
+ handler: ServiceHandler
276
+
277
+ def __init__(
278
+ self,
279
+ *,
280
+ name: str,
281
+ schema: ServiceSchema,
282
+ handler: ServiceHandler,
283
+ ): ...
284
+
285
+ class ServiceSchema:
286
+ """
287
+ A websocket service schema.
288
+ """
289
+
290
+ name: str
291
+ request: MessageSchema | None
292
+ response: MessageSchema | None
293
+
294
+ def __init__(
295
+ self,
296
+ *,
297
+ name: str,
298
+ request: MessageSchema | None = None,
299
+ response: MessageSchema | None = None,
300
+ ): ...
301
+
302
+ class StatusLevel(Enum):
303
+ """A level for `WebSocketServer.publish_status`"""
304
+
305
+ Info = ...
306
+ Warning = ...
307
+ Error = ...
308
+
309
+ class WebSocketServer:
310
+ """
311
+ A websocket server for live visualization.
312
+ """
313
+
314
+ def __init__(self) -> None: ...
315
+ @property
316
+ def port(self) -> int:
317
+ """Get the port on which the server is listening."""
318
+ ...
319
+
320
+ def app_url(
321
+ self,
322
+ *,
323
+ layout_id: str | None = None,
324
+ open_in_desktop: bool = False,
325
+ ) -> str | None:
326
+ """
327
+ Returns a web app URL to open the websocket as a data source.
328
+
329
+ Returns None if the server has been stopped.
330
+
331
+ :param layout_id: An optional layout ID to include in the URL.
332
+ :param open_in_desktop: Opens the foxglove desktop app.
333
+ """
334
+ ...
335
+
336
+ def stop(self) -> None:
337
+ """Explicitly stop the server."""
338
+ ...
339
+
340
+ def clear_session(self, session_id: str | None = None) -> None:
341
+ """
342
+ Sets a new session ID and notifies all clients, causing them to reset their state.
343
+ If no session ID is provided, generates a new one based on the current timestamp.
344
+ If the server has been stopped, this has no effect.
345
+ """
346
+ ...
347
+
348
+ def broadcast_playback_state(self, playback_state: PlaybackState) -> None:
349
+ """
350
+ Publish the current playback state to all clients.
351
+ """
352
+ ...
353
+
354
+ def broadcast_time(self, timestamp_nanos: int) -> None:
355
+ """
356
+ Publishes the current server timestamp to all clients.
357
+ If the server has been stopped, this has no effect.
358
+ """
359
+ ...
360
+
361
+ def publish_parameter_values(self, parameters: list[Parameter]) -> None:
362
+ """Publishes parameter values to all subscribed clients."""
363
+ ...
364
+
365
+ def publish_status(
366
+ self, message: str, level: StatusLevel, id: str | None = None
367
+ ) -> None:
368
+ """
369
+ Send a status message to all clients. If the server has been stopped, this has no effect.
370
+ """
371
+ ...
372
+
373
+ def remove_status(self, ids: list[str]) -> None:
374
+ """
375
+ Remove status messages by id from all clients. If the server has been stopped, this has no
376
+ effect.
377
+ """
378
+ ...
379
+
380
+ def add_services(self, services: list[Service]) -> None:
381
+ """Add services to the server."""
382
+ ...
383
+
384
+ def remove_services(self, names: list[str]) -> None:
385
+ """Removes services that were previously advertised."""
386
+ ...
387
+
388
+ def publish_connection_graph(self, graph: ConnectionGraph) -> None:
389
+ """
390
+ Publishes a connection graph update to all subscribed clients. An update is published to
391
+ clients as a difference from the current graph to the replacement graph. When a client first
392
+ subscribes to connection graph updates, it receives the current graph.
393
+ """
394
+ ...