foxglove-sdk 0.14.1__cp312-cp312-musllinux_1_2_i686.whl → 0.16.6__cp312-cp312-musllinux_1_2_i686.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,4 +1,5 @@
1
1
  import time
2
+ import typing
2
3
  from urllib.parse import parse_qs, urlparse
3
4
 
4
5
  import pytest
@@ -10,14 +11,16 @@ from foxglove import (
10
11
  Service,
11
12
  start_server,
12
13
  )
13
- from foxglove.websocket import ServiceSchema, StatusLevel
14
+ from foxglove.websocket import PlaybackState, PlaybackStatus, ServiceSchema, StatusLevel
14
15
 
15
16
 
16
17
  def test_server_interface() -> None:
17
18
  """
18
19
  Exercise the server interface; will also be checked with mypy.
19
20
  """
20
- server = start_server(port=0, session_id="test-session")
21
+ server = start_server(
22
+ port=0, session_id="test-session", channel_filter=lambda _: True
23
+ )
21
24
  assert isinstance(server.port, int)
22
25
  assert server.port != 0
23
26
 
@@ -45,6 +48,15 @@ def test_server_interface() -> None:
45
48
 
46
49
  server.publish_status("test message", StatusLevel.Info, "some-id")
47
50
  server.broadcast_time(time.time_ns())
51
+ server.broadcast_playback_state(
52
+ PlaybackState(
53
+ status=PlaybackStatus.Paused,
54
+ playback_speed=1.0,
55
+ current_time=time.time_ns(),
56
+ did_seek=False,
57
+ request_id=None,
58
+ )
59
+ )
48
60
  server.remove_status(["some-id"])
49
61
  server.clear_session("new-session")
50
62
  server.stop()
@@ -108,3 +120,22 @@ def test_context_can_be_attached_to_server() -> None:
108
120
 
109
121
  server1.stop()
110
122
  server2.stop()
123
+
124
+
125
+ @typing.no_type_check
126
+ def test_server_with_invalid_playback_time_range() -> None:
127
+ with pytest.raises(TypeError):
128
+ # Tuple of a single element
129
+ start_server(port=0, playback_time_range=(123,))
130
+
131
+ with pytest.raises(TypeError):
132
+ # Tuple with invalid types
133
+ start_server(port=0, playback_time_range=("not-a-time", None))
134
+
135
+ with pytest.raises(TypeError):
136
+ # Not a tuple
137
+ start_server(port=0, playback_time_range=23443)
138
+
139
+ with pytest.raises(TypeError):
140
+ # Tuple with too many elements
141
+ start_server(port=0, playback_time_range=(123, 456, 789))
foxglove/websocket.py CHANGED
@@ -1,5 +1,7 @@
1
+ from __future__ import annotations
2
+
1
3
  from collections.abc import Callable
2
- from typing import Dict, List, Optional, Protocol, Union
4
+ from typing import Optional, Protocol, TypeAlias, Union
3
5
 
4
6
  from ._foxglove_py.websocket import (
5
7
  Capability,
@@ -11,6 +13,10 @@ from ._foxglove_py.websocket import (
11
13
  Parameter,
12
14
  ParameterType,
13
15
  ParameterValue,
16
+ PlaybackCommand,
17
+ PlaybackControlRequest,
18
+ PlaybackState,
19
+ PlaybackStatus,
14
20
  Service,
15
21
  ServiceRequest,
16
22
  ServiceSchema,
@@ -18,10 +24,9 @@ from ._foxglove_py.websocket import (
18
24
  WebSocketServer,
19
25
  )
20
26
 
21
- # Redefine types from the stub interface so they're available for documentation.
22
- ServiceHandler = Callable[["ServiceRequest"], bytes]
23
- AssetHandler = Callable[[str], Optional[bytes]]
24
- AnyParameterValue = Union[
27
+ ServiceHandler: TypeAlias = Callable[[ServiceRequest], bytes]
28
+ AssetHandler: TypeAlias = Callable[[str], "bytes | None"]
29
+ AnyParameterValue: TypeAlias = Union[
25
30
  ParameterValue.Integer,
26
31
  ParameterValue.Bool,
27
32
  ParameterValue.Float64,
@@ -29,17 +34,16 @@ AnyParameterValue = Union[
29
34
  ParameterValue.Array,
30
35
  ParameterValue.Dict,
31
36
  ]
32
- AnyInnerParameterValue = Union[
37
+ AnyInnerParameterValue: TypeAlias = Union[
33
38
  AnyParameterValue,
34
39
  bool,
35
40
  int,
36
41
  float,
37
42
  str,
38
- List["AnyInnerParameterValue"],
39
- Dict[str, "AnyInnerParameterValue"],
43
+ "list[AnyInnerParameterValue]",
44
+ "dict[str, AnyInnerParameterValue]",
40
45
  ]
41
-
42
- AnyNativeParameterValue = Union[
46
+ AnyNativeParameterValue: TypeAlias = Union[
43
47
  AnyInnerParameterValue,
44
48
  bytes,
45
49
  ]
@@ -101,9 +105,9 @@ class ServerListener(Protocol):
101
105
  def on_get_parameters(
102
106
  self,
103
107
  client: Client,
104
- param_names: List[str],
105
- request_id: Optional[str] = None,
106
- ) -> List["Parameter"]:
108
+ param_names: list[str],
109
+ request_id: str | None = None,
110
+ ) -> list[Parameter]:
107
111
  """
108
112
  Called by the server when a client requests parameters.
109
113
 
@@ -118,9 +122,9 @@ class ServerListener(Protocol):
118
122
  def on_set_parameters(
119
123
  self,
120
124
  client: Client,
121
- parameters: List["Parameter"],
122
- request_id: Optional[str] = None,
123
- ) -> List["Parameter"]:
125
+ parameters: list[Parameter],
126
+ request_id: str | None = None,
127
+ ) -> list[Parameter]:
124
128
  """
125
129
  Called by the server when a client sets parameters.
126
130
  Note that only `parameters` which have changed are included in the callback, but the return
@@ -137,7 +141,7 @@ class ServerListener(Protocol):
137
141
 
138
142
  def on_parameters_subscribe(
139
143
  self,
140
- param_names: List[str],
144
+ param_names: list[str],
141
145
  ) -> None:
142
146
  """
143
147
  Called by the server when a client subscribes to one or more parameters for the first time.
@@ -150,7 +154,7 @@ class ServerListener(Protocol):
150
154
 
151
155
  def on_parameters_unsubscribe(
152
156
  self,
153
- param_names: List[str],
157
+ param_names: list[str],
154
158
  ) -> None:
155
159
  """
156
160
  Called by the server when the last client subscription to one or more parameters has been
@@ -174,11 +178,25 @@ class ServerListener(Protocol):
174
178
  """
175
179
  return None
176
180
 
181
+ def on_playback_control_request(
182
+ self, playback_control_request: PlaybackControlRequest
183
+ ) -> Optional[PlaybackState]:
184
+ """
185
+ Called by the server when it receives an updated player state from the client.
186
+
187
+ Requires :py:data:`Capability.RangedPlayback`.
188
+
189
+ :meta private:
190
+ :param playback_control_request: The playback control request sent from the client
191
+ """
192
+ return None
193
+
177
194
 
178
195
  __all__ = [
179
196
  "AnyInnerParameterValue",
180
197
  "AnyNativeParameterValue",
181
198
  "AnyParameterValue",
199
+ "AssetHandler",
182
200
  "Capability",
183
201
  "ChannelView",
184
202
  "Client",
@@ -188,6 +206,10 @@ __all__ = [
188
206
  "Parameter",
189
207
  "ParameterType",
190
208
  "ParameterValue",
209
+ "PlaybackCommand",
210
+ "PlaybackControlRequest",
211
+ "PlaybackState",
212
+ "PlaybackStatus",
191
213
  "ServerListener",
192
214
  "Service",
193
215
  "ServiceHandler",
Binary file
@@ -0,0 +1,53 @@
1
+ Metadata-Version: 2.4
2
+ Name: foxglove-sdk
3
+ Version: 0.16.6
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: Programming Language :: Rust
6
+ Requires-Dist: anywidget ; extra == 'notebook'
7
+ Requires-Dist: mcap ; extra == 'notebook'
8
+ Requires-Dist: traitlets ; extra == 'notebook'
9
+ Provides-Extra: notebook
10
+ Summary: Foxglove Python SDK
11
+ Author-email: Foxglove <support@foxglove.dev>
12
+ License-Expression: MIT
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
15
+ Project-URL: documentation, https://docs.foxglove.dev/
16
+ Project-URL: repository, https://github.com/foxglove/foxglove-sdk
17
+
18
+ # Foxglove Python SDK
19
+
20
+ The official [Foxglove](https://docs.foxglove.dev/docs) SDK for Python.
21
+
22
+ This package provides support for integrating with the Foxglove platform. It can be used to log
23
+ events to local [MCAP](https://mcap.dev/) files or a local visualization server that communicates
24
+ with the Foxglove app.
25
+
26
+ ## Get Started
27
+
28
+ See https://foxglove.github.io/foxglove-sdk/python/
29
+
30
+ ## Requirements
31
+
32
+ - Python 3.10+
33
+
34
+ ## Examples
35
+
36
+ We're using uv as a Python package manager in the foxglove-sdk-examples.
37
+
38
+ To test that all examples run (as the CI does) you can use `yarn run-python-sdk-examples` in the repo root.
39
+
40
+ To run a specific example (e.g. write-mcap-file) with local changes:
41
+
42
+ ```
43
+ cd python/foxglove-sdk-examples/write-mcap-file
44
+ uv run --with ../../foxglove-sdk main.py [args]
45
+ ```
46
+
47
+ Keep in mind that uv does two layers of caching.
48
+ There's the .venv in your project directory, plus a global cache at ~/.cache/uv.
49
+
50
+ uv tries to be smart about not rebuilding things it has already built,
51
+ which means that if you make changes and you want them to show up,
52
+ you also need to run `uv cache clean`.
53
+
@@ -0,0 +1,35 @@
1
+ foxglove/__init__.py,sha256=AXj9sq9K8_YCgkDDtyyw0bUSsuCpDg7gjzmgTvIUyI0,8478
2
+ foxglove/_foxglove_py/__init__.pyi,sha256=Ppw0LllCD5Jos1ZGPwEefRFJXVEj9ZWd_Nez2hUYjSs,6072
3
+ foxglove/_foxglove_py/channels.pyi,sha256=UfltAzsnYnukOD5aUi_3iFrMNkRQ0CireBsEO-Q2DjY,68973
4
+ foxglove/_foxglove_py/cloud.pyi,sha256=9Hqj7b9S2CTiWeWOIqaAw3GSmR-cGoSL4R7fi5WI-QA,255
5
+ foxglove/_foxglove_py/mcap.pyi,sha256=yh3RDXNiqSN5URCQF0efxezmWldvdQk_VHlW-clS0Cw,4936
6
+ foxglove/_foxglove_py/schemas.pyi,sha256=q_wlO-mkKGC3IuzVVXL6Ehxf5I240BOyginxt47EJqA,24212
7
+ foxglove/_foxglove_py/schemas_wkt.pyi,sha256=_nHeIdbOKMgPeL5V360-vZXCnEtyRIFzEd_JVsK49qo,2065
8
+ foxglove/_foxglove_py/websocket.pyi,sha256=NuCIpXp9P2bPNLyvjVYqcaeL71wKRyYB6RbTfkE6X7A,10511
9
+ foxglove/_foxglove_py.cpython-312-i386-linux-musl.so,sha256=NPs33L9BQic8qTfK3Kd5MK_RNKgOlLnAJewJpmUoAFM,6053821
10
+ foxglove/benchmarks/test_mcap_serialization.py,sha256=Ab_J2Mz8Vya5ZD8Yypp2jdfhaOCxYW7hw5fos7LyFXk,4682
11
+ foxglove/channel.py,sha256=N9jUQXhD-wZq1lnZbRlNUPgBb79CiDksTeFYwTnAY6Y,8447
12
+ foxglove/channels/__init__.py,sha256=DOdeiFZ0bSquutHtkVxtmQmX78eiDfTmIl-OdVc7Btg,2452
13
+ foxglove/cloud.py,sha256=eOHV8ZCnut59uBLiw1c5MiwbIALeVwPzxo2Yb-2jbII,1942
14
+ foxglove/layouts/__init__.py,sha256=iC2-pMCrwGKkGWHzAsAbADONmL-tI3Rh_GT1AAfP6YI,517
15
+ foxglove/mcap.py,sha256=LR9TSyRlDWuHZpXR8iglmDp-S-4BRqgmvTOiUKHwlsA,200
16
+ foxglove/notebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ foxglove/notebook/foxglove_widget.py,sha256=o-X47mFMU_WxZqNQxKMGQUFXWrqdSeUB_TYrwqXY4WM,2715
18
+ foxglove/notebook/notebook_buffer.py,sha256=o-m1coYMluqusBIeSAIvfSLaJQyMx7yRTGZzLX6vByw,3784
19
+ foxglove/notebook/static/widget.js,sha256=x5B4Vv_2c38Lx7Xbqn8UBAYEZ57Cz18Gsvwa7TnRzbQ,4035
20
+ foxglove/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ foxglove/schemas/__init__.py,sha256=Jd-tsarhV55ZsK4z75-6BUAqINxoNkeyYLnwWZjmfW4,3291
22
+ foxglove/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ foxglove/tests/test_channel.py,sha256=coIPG-P_8Uczhw2-zRo4FoanlkReiE1CKUppM9mO1oE,7146
24
+ foxglove/tests/test_context.py,sha256=OvtvjzsRaZZHPT0RyRkwrpBip-7uLaxVPwlu2RJ12yY,256
25
+ foxglove/tests/test_logging.py,sha256=G2Mljb9nN5BOY5qKAeYo0x_2blY1iIRh9s80k0O3vaI,1472
26
+ foxglove/tests/test_mcap.py,sha256=Y4OYgWvkPSD288rJdlrgg1haVGeDRR39sWeUcb6VO8E,14863
27
+ foxglove/tests/test_parameters.py,sha256=18YsSPNnSM3VjVCh-Ag4S9mBv2G-x2zSwi5wzQClvqo,4861
28
+ foxglove/tests/test_schemas.py,sha256=4empQg8gqS7MD63ibU3kdQgJUSsUpnNQQWQ7oAf-4xk,423
29
+ foxglove/tests/test_server.py,sha256=rR50x21OOUMVuyYmYqiRTxOrgJFyL4ZL9W4pOshfAFc,3795
30
+ foxglove/tests/test_time.py,sha256=By_sM5r87s9iu4Df12r6p9DJrzTeZSLys3XGUGhvUps,4661
31
+ foxglove/websocket.py,sha256=PvsSGmWFayjRV20u86ZEZ9zcUD7nBC9j6CKPWNZy5ks,6331
32
+ foxglove.libs/libgcc_s-8c2f5de4.so.1,sha256=kSGru1K5a_vOr1EMn5GXfvaYMUTnHaCTddYVIrEEuao,552385
33
+ foxglove_sdk-0.16.6.dist-info/METADATA,sha256=H_fB1z_2pxFbjqg902aUJ0uR6AMq1FBr4uVV4BM9w_Q,1716
34
+ foxglove_sdk-0.16.6.dist-info/WHEEL,sha256=rWYtim5tY9WaCqCvXEBzhyghBBzvRtIqa4ih936RQuE,106
35
+ foxglove_sdk-0.16.6.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.9.4)
2
+ Generator: maturin (1.11.5)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-musllinux_1_2_i686
Binary file
@@ -1,29 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: foxglove-sdk
3
- Version: 0.14.1
4
- Classifier: Programming Language :: Python :: 3
5
- Classifier: Programming Language :: Rust
6
- Summary: Foxglove Python SDK
7
- Author-email: Foxglove <support@foxglove.dev>
8
- License-Expression: MIT
9
- Requires-Python: >=3.9
10
- Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
11
- Project-URL: repository, https://github.com/foxglove/foxglove-sdk
12
- Project-URL: documentation, https://docs.foxglove.dev/
13
-
14
- # Foxglove Python SDK
15
-
16
- The official [Foxglove](https://docs.foxglove.dev/docs) SDK for Python.
17
-
18
- This package provides support for integrating with the Foxglove platform. It can be used to log
19
- events to local [MCAP](https://mcap.dev/) files or a local visualization server that communicates
20
- with the Foxglove app.
21
-
22
- ## Get Started
23
-
24
- See https://foxglove.github.io/foxglove-sdk/python/
25
-
26
- ## Requirements
27
-
28
- - Python 3.9+
29
-
@@ -1,27 +0,0 @@
1
- foxglove.libs/libgcc_s-27e5a392.so.1,sha256=x5sO63liVwXxrjGGP371wB0RyQe1KEnIynYm82T0G0M,449745
2
- foxglove/__init__.py,sha256=qS0pU2PgD7u4XwTBKlfKx9LSbscEd2Z5Mm_39dtIhaE,4049
3
- foxglove/_foxglove_py.cpython-312-i386-linux-musl.so,sha256=B-oH13OLnweXeJTRFSmlEUl9w5I6tcKz7cu6AjYW-nc,6041485
4
- foxglove/_foxglove_py/__init__.pyi,sha256=HIfNaA81UEoEpRMRHKLhqF5VJdHRowKWjYqgWSy4nAQ,4378
5
- foxglove/_foxglove_py/channels.pyi,sha256=CJwodbsuczEwkGL1ug8C8gweupiZuD3rcasWMbeNDpY,68538
6
- foxglove/_foxglove_py/mcap.pyi,sha256=Th06-rPq4an_RjQ_TSmsLSfGAkelFfyLoBAgQUiXl_I,3308
7
- foxglove/_foxglove_py/schemas.pyi,sha256=j_VBenCal1hQuxuPR1UcYIA8Fde3hl07h3jVqYuxUwk,25347
8
- foxglove/_foxglove_py/schemas_wkt.pyi,sha256=5IKyMXk6ZFv0v7ElP9843KgE-ESCLo9IQHRH-IJXTTU,2108
9
- foxglove/_foxglove_py/websocket.pyi,sha256=HACC078Wn0rZPFfG4ufl5iNTkgDPB0KTRNT52ikFgZQ,8910
10
- foxglove/benchmarks/test_mcap_serialization.py,sha256=Ab_J2Mz8Vya5ZD8Yypp2jdfhaOCxYW7hw5fos7LyFXk,4682
11
- foxglove/channel.py,sha256=ODWh0umbmQlAQXXbSPMmmG9juUsQkC1zpAYO1YWMZUs,8481
12
- foxglove/channels/__init__.py,sha256=qTr5-HKlr4e386onX9OiYBPWUsS1n2vO23PncL0TiPY,2398
13
- foxglove/mcap.py,sha256=LR9TSyRlDWuHZpXR8iglmDp-S-4BRqgmvTOiUKHwlsA,200
14
- foxglove/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- foxglove/schemas/__init__.py,sha256=bqYBLc0HXRe-BMRP3VnF9IUB2yKYsvku3pZnulss3GY,3232
16
- foxglove/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- foxglove/tests/test_channel.py,sha256=coIPG-P_8Uczhw2-zRo4FoanlkReiE1CKUppM9mO1oE,7146
18
- foxglove/tests/test_logging.py,sha256=r219wdtEO8f6T0LfTTbTmWrEtHD_WznMm_g4SoJ6Byc,355
19
- foxglove/tests/test_mcap.py,sha256=GpYbsyoSghV7RECl6QRwR1CfQ_mATujLSzrs9f-XolE,3081
20
- foxglove/tests/test_parameters.py,sha256=18YsSPNnSM3VjVCh-Ag4S9mBv2G-x2zSwi5wzQClvqo,4861
21
- foxglove/tests/test_schemas.py,sha256=4empQg8gqS7MD63ibU3kdQgJUSsUpnNQQWQ7oAf-4xk,423
22
- foxglove/tests/test_server.py,sha256=FGcnezEuMtublhIQilFSytqPKQDZpCmY4jJzMJhIWn8,2848
23
- foxglove/tests/test_time.py,sha256=By_sM5r87s9iu4Df12r6p9DJrzTeZSLys3XGUGhvUps,4661
24
- foxglove/websocket.py,sha256=DF4571PPs0sWRaHq2mRxEYa63BivdHQaH16hkZst6OQ,5697
25
- foxglove_sdk-0.14.1.dist-info/METADATA,sha256=HyDe4aJQHurgZncD5Z3qhIMO1yCtrvJ3jY428hTANME,873
26
- foxglove_sdk-0.14.1.dist-info/WHEEL,sha256=-VBVXxxhuW7vs-AzuH1J4ij07cmaOVykeZTmSK682KE,105
27
- foxglove_sdk-0.14.1.dist-info/RECORD,,