foxglove-sdk 0.16.3__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 0.16.4__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_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.

Potentially problematic release.


This version of foxglove-sdk might be problematic. Click here for more details.

foxglove/__init__.py CHANGED
@@ -176,30 +176,26 @@ def _level_names() -> dict[str, int]:
176
176
 
177
177
  def init_notebook_buffer(context: Context | None = None) -> NotebookBuffer:
178
178
  """
179
- Create a NotebookBuffer object to manage data buffering and visualization in Jupyter
180
- notebooks.
181
-
182
- The NotebookBuffer object will buffer all data logged to the provided context. When you
183
- are ready to visualize the data, you can call the :meth:`show` method to display an embedded
184
- Foxglove visualization widget. The widget provides a fully-featured Foxglove interface
185
- directly within your Jupyter notebook, allowing you to explore multi-modal robotics data
186
- including 3D scenes, plots, images, and more.
187
-
188
- Args:
189
- context: The Context used to log the messages. If no Context is provided, the global
190
- context will be used. Logged messages will be buffered.
191
-
192
- Returns:
193
- NotebookBuffer: A NotebookBuffer object that can be used to manage the data buffering
194
- and visualization.
195
-
196
- Raises:
197
- Exception: If the notebook extra package is not installed. Install it
198
- with `pip install foxglove-sdk[notebook]`.
199
-
200
- Note:
201
- This function is only available when the `notebook` extra package
202
- is installed. Install it with `pip install foxglove-sdk[notebook]`.
179
+ Create a NotebookBuffer object to manage data buffering and visualization in Jupyter notebooks.
180
+
181
+ The NotebookBuffer object will buffer all data logged to the provided context. When you are
182
+ ready to visualize the data, you can call the
183
+ :meth:`~notebook.notebook_buffer.NotebookBuffer.show` method to display an embedded Foxglove
184
+ visualization widget. The widget provides a fully-featured Foxglove interface directly within
185
+ your Jupyter notebook, allowing you to explore multi-modal robotics data including 3D scenes,
186
+ plots, images, and more.
187
+
188
+ :param context: The Context used to log the messages. If no Context is provided, the global
189
+ context will be used. Logged messages will be buffered.
190
+
191
+ :returns: A NotebookBuffer object that can be used to manage the data buffering and
192
+ visualization.
193
+
194
+ :raises Exception: If the notebook extra package is not installed. Install it with ``pip install
195
+ foxglove-sdk[notebook]``.
196
+
197
+ :note: This function is only available when the `notebook` extra package is installed. Install
198
+ it with ``pip install foxglove-sdk[notebook]``.
203
199
 
204
200
  Example:
205
201
  >>> import foxglove
@@ -24,6 +24,7 @@ from .schemas import (
24
24
  PackedElementField,
25
25
  Point2,
26
26
  Point3,
27
+ Point3InFrame,
27
28
  PointCloud,
28
29
  PointsAnnotation,
29
30
  Pose,
@@ -1585,6 +1586,73 @@ class Point3Channel:
1585
1586
  """Log a Foxglove Point3 message on the channel."""
1586
1587
  ...
1587
1588
 
1589
+ class Point3InFrameChannel:
1590
+ """
1591
+ A channel for logging Point3InFrame messages
1592
+
1593
+ You should choose a unique topic name per channel.
1594
+ """
1595
+
1596
+ def __init__(
1597
+ self,
1598
+ topic: str,
1599
+ *,
1600
+ metadata: dict[str, str] | None = None,
1601
+ context: Context | None = None,
1602
+ ) -> None: ...
1603
+ def id(self) -> int:
1604
+ """The unique ID of the channel."""
1605
+ ...
1606
+
1607
+ def topic(self) -> str:
1608
+ """The topic name of the channel."""
1609
+ ...
1610
+
1611
+ @property
1612
+ def message_encoding(self) -> str:
1613
+ """The message encoding for the channel"""
1614
+ ...
1615
+
1616
+ def metadata(self) -> dict[str, str]:
1617
+ """
1618
+ Returns a copy of the channel's metadata.
1619
+
1620
+ Note that changes made to the returned dictionary will not be applied to
1621
+ the channel's metadata.
1622
+ """
1623
+ ...
1624
+
1625
+ def schema(self) -> Schema | None:
1626
+ """
1627
+ Returns a copy of the channel's schema.
1628
+
1629
+ Note that changes made to the returned object will not be applied to
1630
+ the channel's schema.
1631
+ """
1632
+ ...
1633
+
1634
+ def schema_name(self) -> str | None:
1635
+ """The name of the schema for the channel."""
1636
+ ...
1637
+
1638
+ def has_sinks(self) -> bool:
1639
+ """Returns true if at least one sink is subscribed to this channel"""
1640
+ ...
1641
+
1642
+ def close(self) -> None:
1643
+ """Close the channel."""
1644
+ ...
1645
+
1646
+ def log(
1647
+ self,
1648
+ message: "Point3InFrame",
1649
+ *,
1650
+ log_time: int | None = None,
1651
+ sink_id: int | None = None,
1652
+ ) -> None:
1653
+ """Log a Foxglove Point3InFrame message on the channel."""
1654
+ ...
1655
+
1588
1656
  class PointCloudChannel:
1589
1657
  """
1590
1658
  A channel for logging PointCloud messages
@@ -567,6 +567,27 @@ class Point3:
567
567
  """Encodes the Point3."""
568
568
  ...
569
569
 
570
+ class Point3InFrame:
571
+ """
572
+ A timestamped point for a position in 3D space
573
+ """
574
+
575
+ def __init__(
576
+ self,
577
+ *,
578
+ timestamp: Timestamp | None = None,
579
+ frame_id: str = "",
580
+ point: Point3 | None = None,
581
+ ) -> None: ...
582
+ @staticmethod
583
+ def get_schema() -> Schema:
584
+ """Returns the Point3InFrame schema"""
585
+ ...
586
+
587
+ def encode(self) -> bytes:
588
+ """Encodes the Point3InFrame."""
589
+ ...
590
+
570
591
  class PointCloud:
571
592
  """
572
593
  A collection of N-dimensional points, which may contain additional fields with information like normals, intensity, etc.
@@ -992,6 +1013,7 @@ FoxgloveSchema = Union[
992
1013
  PackedElementField,
993
1014
  Point2,
994
1015
  Point3,
1016
+ Point3InFrame,
995
1017
  PointCloud,
996
1018
  PointsAnnotation,
997
1019
  Pose,
foxglove/channel.py CHANGED
@@ -35,7 +35,7 @@ class Channel:
35
35
  Create a new channel for logging messages on a topic.
36
36
 
37
37
  :param topic: The topic name. You should choose a unique topic name per channel.
38
- :param message_encoding: The message encoding. Optional if :py:param:`schema` is a
38
+ :param message_encoding: The message encoding. Optional if :any:`schema` is a
39
39
  dictionary, in which case the message encoding is presumed to be "json".
40
40
  :param schema: A definition of your schema. Pass a :py:class:`Schema` for full control. If a
41
41
  dictionary is passed, it will be treated as a JSON schema.
@@ -29,6 +29,7 @@ from foxglove._foxglove_py.channels import (
29
29
  PackedElementFieldChannel,
30
30
  Point2Channel,
31
31
  Point3Channel,
32
+ Point3InFrameChannel,
32
33
  PointCloudChannel,
33
34
  PointsAnnotationChannel,
34
35
  PoseChannel,
@@ -73,6 +74,7 @@ __all__ = [
73
74
  "PackedElementFieldChannel",
74
75
  "Point2Channel",
75
76
  "Point3Channel",
77
+ "Point3InFrameChannel",
76
78
  "PointCloudChannel",
77
79
  "PointsAnnotationChannel",
78
80
  "PoseChannel",
@@ -0,0 +1,17 @@
1
+ """
2
+ This module defines types for programmatically constructing Foxglove `layouts <https://docs.foxglove.dev/docs/visualization/layouts>`_.
3
+
4
+ This API is currently experimental and not ready for public use.
5
+ """
6
+
7
+
8
+ class Layout:
9
+ """A Foxglove layout
10
+
11
+ :raises NotImplementedError: This class is currently experimental and not ready for public use.
12
+ """
13
+
14
+ def to_json(self) -> str:
15
+ raise NotImplementedError(
16
+ "This class is currently experimental and not ready for public use."
17
+ )
@@ -1,24 +1,19 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import pathlib
4
- from typing import TYPE_CHECKING, Any, Literal
4
+ from typing import TYPE_CHECKING, Literal
5
5
 
6
6
  import anywidget
7
7
  import traitlets
8
8
 
9
9
  if TYPE_CHECKING:
10
+ from ..layouts import Layout
10
11
  from .notebook_buffer import NotebookBuffer
11
12
 
12
13
 
13
14
  class FoxgloveWidget(anywidget.AnyWidget):
14
15
  """
15
16
  A widget that displays a Foxglove viewer in a notebook.
16
-
17
- :param buffer: The NotebookBuffer object that contains the data to display in the widget.
18
- :param layout_storage_key: The storage key of the layout to use for the widget.
19
- :param width: The width of the widget. Defaults to "full".
20
- :param height: The height of the widget in pixels. Defaults to 500.
21
- :param src: The source URL of the Foxglove viewer. Defaults to "https://embed.foxglove.dev/".
22
17
  """
23
18
 
24
19
  _esm = pathlib.Path(__file__).parent / "static" / "widget.js"
@@ -27,26 +22,25 @@ class FoxgloveWidget(anywidget.AnyWidget):
27
22
  ).tag(sync=True)
28
23
  height = traitlets.Int(default_value=500).tag(sync=True)
29
24
  src = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True)
30
- _layout_params = traitlets.Dict(
31
- per_key_traits={
32
- "storage_key": traitlets.Unicode(),
33
- "opaque_layout": traitlets.Dict(allow_none=True, default_value=None),
34
- "force": traitlets.Bool(False),
35
- },
36
- allow_none=True,
37
- default_value=None,
38
- ).tag(sync=True)
25
+ _layout = traitlets.Unicode(default_value=None, allow_none=True).tag(sync=True)
39
26
 
40
27
  def __init__(
41
28
  self,
29
+ *,
42
30
  buffer: NotebookBuffer,
43
- layout_storage_key: str,
44
31
  width: int | Literal["full"] | None = None,
45
32
  height: int | None = None,
46
33
  src: str | None = None,
47
- **kwargs: Any,
34
+ layout: Layout | None = None,
48
35
  ):
49
- super().__init__(**kwargs)
36
+ """
37
+ :param buffer: The NotebookBuffer object that contains the data to display in the widget.
38
+ :param width: The width of the widget. Defaults to "full".
39
+ :param height: The height of the widget in pixels. Defaults to 500.
40
+ :param src: The source URL of the Foxglove viewer. Defaults to
41
+ "https://embed.foxglove.dev/".
42
+ """
43
+ super().__init__()
50
44
  if width is not None:
51
45
  self.width = width
52
46
  else:
@@ -56,7 +50,8 @@ class FoxgloveWidget(anywidget.AnyWidget):
56
50
  if src is not None:
57
51
  self.src = src
58
52
 
59
- self.select_layout(layout_storage_key, **kwargs)
53
+ if layout is not None:
54
+ self._layout = layout.to_json()
60
55
 
61
56
  # Callback to get the data to display in the widget
62
57
  self._buffer = buffer
@@ -67,25 +62,12 @@ class FoxgloveWidget(anywidget.AnyWidget):
67
62
  self.on_msg(self._handle_custom_msg)
68
63
  self.refresh()
69
64
 
70
- def select_layout(self, storage_key: str, **kwargs: Any) -> None:
71
- """
72
- Select a layout in the Foxglove viewer.
73
- """
74
- opaque_layout = kwargs.get("opaque_layout", None)
75
- force_layout = kwargs.get("force_layout", False)
76
-
77
- self._layout_params = {
78
- "storage_key": storage_key,
79
- "opaque_layout": opaque_layout if isinstance(opaque_layout, dict) else None,
80
- "force": force_layout,
81
- }
82
-
83
65
  def refresh(self) -> None:
84
66
  """
85
67
  Refresh the widget by getting the data from the callback function and sending it
86
68
  to the widget.
87
69
  """
88
- data = self._buffer.get_data()
70
+ data = self._buffer._get_data()
89
71
  if not self._ready:
90
72
  self._pending_data = data
91
73
  else:
@@ -3,11 +3,12 @@ from __future__ import annotations
3
3
  import os
4
4
  import uuid
5
5
  from tempfile import TemporaryDirectory
6
- from typing import Any, Literal
6
+ from typing import Literal
7
7
 
8
8
  from mcap.reader import make_reader
9
9
 
10
10
  from .._foxglove_py import Context, open_mcap
11
+ from ..layouts import Layout
11
12
  from .foxglove_widget import FoxgloveWidget
12
13
 
13
14
 
@@ -20,14 +21,14 @@ class NotebookBuffer:
20
21
  Foxglove visualization widget. The widget provides a fully-featured Foxglove interface
21
22
  directly within your Jupyter notebook, allowing you to explore multi-modal robotics data
22
23
  including 3D scenes, plots, images, and more.
23
-
24
- :param context: The Context used to log the messages. If no Context is provided, the global
25
- context will be used. Logged messages will be buffered.
26
24
  """
27
25
 
28
- def __init__(self, context: Context | None = None):
26
+ def __init__(self, *, context: Context | None = None):
29
27
  """
30
28
  Initialize a new NotebookBuffer for collecting logged messages.
29
+
30
+ :param context: The Context used to log the messages. If no Context is provided, the global
31
+ context will be used. Logged messages will be buffered.
31
32
  """
32
33
  # We need to keep the temporary directory alive until the writer is closed
33
34
  self._temp_directory = TemporaryDirectory()
@@ -37,11 +38,11 @@ class NotebookBuffer:
37
38
 
38
39
  def show(
39
40
  self,
40
- layout_storage_key: str,
41
+ *,
41
42
  width: int | Literal["full"] | None = None,
42
43
  height: int | None = None,
43
44
  src: str | None = None,
44
- **kwargs: Any,
45
+ layout: Layout | None = None,
45
46
  ) -> FoxgloveWidget:
46
47
  """
47
48
  Show the Foxglove viewer. Call this method as the last step of a notebook cell
@@ -52,8 +53,7 @@ class NotebookBuffer:
52
53
  width=width,
53
54
  height=height,
54
55
  src=src,
55
- layout_storage_key=layout_storage_key,
56
- **kwargs,
56
+ layout=layout,
57
57
  )
58
58
  return widget
59
59
 
@@ -70,7 +70,7 @@ class NotebookBuffer:
70
70
  self._temp_directory = TemporaryDirectory()
71
71
  self._create_writer()
72
72
 
73
- def get_data(self) -> list[bytes]:
73
+ def _get_data(self) -> list[bytes]:
74
74
  """
75
75
  Retrieve all collected data.
76
76
  """
@@ -40,6 +40,7 @@ from foxglove._foxglove_py.schemas import (
40
40
  PackedElementFieldNumericType,
41
41
  Point2,
42
42
  Point3,
43
+ Point3InFrame,
43
44
  PointCloud,
44
45
  PointsAnnotation,
45
46
  PointsAnnotationType,
@@ -88,6 +89,7 @@ FoxgloveSchema = Union[
88
89
  PackedElementField,
89
90
  Point2,
90
91
  Point3,
92
+ Point3InFrame,
91
93
  PointCloud,
92
94
  PointsAnnotation,
93
95
  Pose,
@@ -139,6 +141,7 @@ __all__ = [
139
141
  "PackedElementFieldNumericType",
140
142
  "Point2",
141
143
  "Point3",
144
+ "Point3InFrame",
142
145
  "PointCloud",
143
146
  "PointsAnnotation",
144
147
  "PointsAnnotationType",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: foxglove-sdk
3
- Version: 0.16.3
3
+ Version: 0.16.4
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Rust
6
6
  Requires-Dist: anywidget ; extra == 'notebook'
@@ -1,22 +1,23 @@
1
- foxglove/__init__.py,sha256=utf_uU_ViL7xDrTqheP6JGs3ezfPsnve2EXFdS0uq-A,8490
1
+ foxglove/__init__.py,sha256=AXj9sq9K8_YCgkDDtyyw0bUSsuCpDg7gjzmgTvIUyI0,8478
2
2
  foxglove/_foxglove_py/__init__.pyi,sha256=Ppw0LllCD5Jos1ZGPwEefRFJXVEj9ZWd_Nez2hUYjSs,6072
3
- foxglove/_foxglove_py/channels.pyi,sha256=c3WXhK5FfeCJ1aDGB-AsayIossnC8v8qFij0XWl1AEA,67327
3
+ foxglove/_foxglove_py/channels.pyi,sha256=UfltAzsnYnukOD5aUi_3iFrMNkRQ0CireBsEO-Q2DjY,68973
4
4
  foxglove/_foxglove_py/cloud.pyi,sha256=9Hqj7b9S2CTiWeWOIqaAw3GSmR-cGoSL4R7fi5WI-QA,255
5
5
  foxglove/_foxglove_py/mcap.pyi,sha256=yh3RDXNiqSN5URCQF0efxezmWldvdQk_VHlW-clS0Cw,4936
6
- foxglove/_foxglove_py/schemas.pyi,sha256=oVF6fwYlgoZ8a1FmlLhVgCYbz-ueM52NyuuTtwhGuFc,23092
6
+ foxglove/_foxglove_py/schemas.pyi,sha256=7KfRHDMIbwOxsRLMdweMsH_qXiSySmKrVo82dutcjtw,23566
7
7
  foxglove/_foxglove_py/schemas_wkt.pyi,sha256=_nHeIdbOKMgPeL5V360-vZXCnEtyRIFzEd_JVsK49qo,2065
8
8
  foxglove/_foxglove_py/websocket.pyi,sha256=NuCIpXp9P2bPNLyvjVYqcaeL71wKRyYB6RbTfkE6X7A,10511
9
- foxglove/_foxglove_py.cpython-312-aarch64-linux-gnu.so,sha256=wR2OWmMU5uQJgyXfvPqEAw4FYo227AEb_ZHEO7K3yKM,6461552
9
+ foxglove/_foxglove_py.cpython-312-aarch64-linux-gnu.so,sha256=F5odzTQmvOk7S0PJtYRNcV_JOlg3NjbKdSsKGT9uvRY,6513304
10
10
  foxglove/benchmarks/test_mcap_serialization.py,sha256=Ab_J2Mz8Vya5ZD8Yypp2jdfhaOCxYW7hw5fos7LyFXk,4682
11
- foxglove/channel.py,sha256=MRiiOm09ZNATOvVCFuvn19KB9HkVCtsDTJYiqE7LQlA,8452
12
- foxglove/channels/__init__.py,sha256=qTr5-HKlr4e386onX9OiYBPWUsS1n2vO23PncL0TiPY,2398
11
+ foxglove/channel.py,sha256=N9jUQXhD-wZq1lnZbRlNUPgBb79CiDksTeFYwTnAY6Y,8447
12
+ foxglove/channels/__init__.py,sha256=DOdeiFZ0bSquutHtkVxtmQmX78eiDfTmIl-OdVc7Btg,2452
13
13
  foxglove/cloud.py,sha256=eOHV8ZCnut59uBLiw1c5MiwbIALeVwPzxo2Yb-2jbII,1942
14
+ foxglove/layouts/__init__.py,sha256=iC2-pMCrwGKkGWHzAsAbADONmL-tI3Rh_GT1AAfP6YI,517
14
15
  foxglove/mcap.py,sha256=LR9TSyRlDWuHZpXR8iglmDp-S-4BRqgmvTOiUKHwlsA,200
15
16
  foxglove/notebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- foxglove/notebook/foxglove_widget.py,sha256=mOXElZLZSIQfvzbZfMd2jtvmWA-H4Z8j7fa39Vwns34,3418
17
- foxglove/notebook/notebook_buffer.py,sha256=ooQIb8xcyNeuCoRm7CL0Uhnh9VPcd41YMUNYRu15FYg,3801
17
+ foxglove/notebook/foxglove_widget.py,sha256=o-X47mFMU_WxZqNQxKMGQUFXWrqdSeUB_TYrwqXY4WM,2715
18
+ foxglove/notebook/notebook_buffer.py,sha256=o-m1coYMluqusBIeSAIvfSLaJQyMx7yRTGZzLX6vByw,3784
18
19
  foxglove/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- foxglove/schemas/__init__.py,sha256=bqYBLc0HXRe-BMRP3VnF9IUB2yKYsvku3pZnulss3GY,3232
20
+ foxglove/schemas/__init__.py,sha256=Jd-tsarhV55ZsK4z75-6BUAqINxoNkeyYLnwWZjmfW4,3291
20
21
  foxglove/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
22
  foxglove/tests/test_channel.py,sha256=coIPG-P_8Uczhw2-zRo4FoanlkReiE1CKUppM9mO1oE,7146
22
23
  foxglove/tests/test_context.py,sha256=OvtvjzsRaZZHPT0RyRkwrpBip-7uLaxVPwlu2RJ12yY,256
@@ -27,6 +28,6 @@ foxglove/tests/test_schemas.py,sha256=4empQg8gqS7MD63ibU3kdQgJUSsUpnNQQWQ7oAf-4x
27
28
  foxglove/tests/test_server.py,sha256=rR50x21OOUMVuyYmYqiRTxOrgJFyL4ZL9W4pOshfAFc,3795
28
29
  foxglove/tests/test_time.py,sha256=By_sM5r87s9iu4Df12r6p9DJrzTeZSLys3XGUGhvUps,4661
29
30
  foxglove/websocket.py,sha256=PvsSGmWFayjRV20u86ZEZ9zcUD7nBC9j6CKPWNZy5ks,6331
30
- foxglove_sdk-0.16.3.dist-info/METADATA,sha256=-R_TiQnJptVFk1IqvoAQ10Fbk0wSm17dC-gEUe8MPDw,1716
31
- foxglove_sdk-0.16.3.dist-info/WHEEL,sha256=52Zi36pDPQlOrLthVvXF6f11TX-HRQ2sllWxsSJsrtQ,149
32
- foxglove_sdk-0.16.3.dist-info/RECORD,,
31
+ foxglove_sdk-0.16.4.dist-info/METADATA,sha256=fkqCQDIXd4Is1uADW2P_0G0aAtHJmpq0_u4tmKZe_xg,1716
32
+ foxglove_sdk-0.16.4.dist-info/WHEEL,sha256=52Zi36pDPQlOrLthVvXF6f11TX-HRQ2sllWxsSJsrtQ,149
33
+ foxglove_sdk-0.16.4.dist-info/RECORD,,