figpack 0.2.21__py3-none-any.whl → 0.2.23__py3-none-any.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 figpack might be problematic. Click here for more details.

@@ -9,7 +9,7 @@
9
9
  // Allow script injection from trusted domains (see src/main.tsx)
10
10
  window.script_injection_allowed_domains = ['https://manage.figpack.org', 'https://figpack.org'];
11
11
  </script>
12
- <script type="module" crossorigin src="./assets/index-CpEyLZdu.js"></script>
12
+ <script type="module" crossorigin src="./assets/index-CLEO_r6_.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="./assets/index-V5m_wCvw.css">
14
14
  </head>
15
15
  <body>
figpack/views/Box.py CHANGED
@@ -42,7 +42,7 @@ class Box(FigpackView):
42
42
  self.items = items
43
43
  self.title = title
44
44
 
45
- def _write_to_zarr_group(self, group: Group) -> None:
45
+ def write_to_zarr_group(self, group: Group) -> None:
46
46
  """
47
47
  Write the Box layout data to a Zarr group
48
48
 
@@ -73,7 +73,7 @@ class Box(FigpackView):
73
73
  item_group = group.create_group(item_name)
74
74
 
75
75
  # Recursively write the child view to the subgroup
76
- item.view._write_to_zarr_group(item_group)
76
+ item.view.write_to_zarr_group(item_group)
77
77
 
78
78
  # Store the items metadata
79
79
  group.attrs["items"] = items_metadata
@@ -33,7 +33,7 @@ class DataFrame(FigpackView):
33
33
 
34
34
  self.df = df
35
35
 
36
- def _write_to_zarr_group(self, group: Group) -> None:
36
+ def write_to_zarr_group(self, group: Group) -> None:
37
37
  """
38
38
  Write the DataFrame data to a Zarr group
39
39
 
figpack/views/Gallery.py CHANGED
@@ -44,7 +44,7 @@ class Gallery(FigpackView):
44
44
  max(0, min(initial_item_index, len(items) - 1)) if items else 0
45
45
  )
46
46
 
47
- def _write_to_zarr_group(self, group: Group) -> None:
47
+ def write_to_zarr_group(self, group: Group) -> None:
48
48
  """
49
49
  Write the Gallery data to a Zarr group
50
50
 
@@ -80,7 +80,7 @@ class Gallery(FigpackView):
80
80
 
81
81
  # Recursively write the child view to the subgroup
82
82
  # This allows any figpack view to be contained within a gallery item
83
- item.view._write_to_zarr_group(item_group)
83
+ item.view.write_to_zarr_group(item_group)
84
84
 
85
85
  # Store the complete items metadata in the group attributes
86
86
  # This will be used by the frontend to render the gallery structure
figpack/views/Image.py CHANGED
@@ -70,7 +70,7 @@ class Image(FigpackView):
70
70
  except Exception as e:
71
71
  raise ValueError(f"Failed to download image from URL: {str(e)}")
72
72
 
73
- def _write_to_zarr_group(self, group: Group) -> None:
73
+ def write_to_zarr_group(self, group: Group) -> None:
74
74
  """
75
75
  Write the image data to a Zarr group
76
76
 
figpack/views/Markdown.py CHANGED
@@ -23,7 +23,7 @@ class Markdown(FigpackView):
23
23
  """
24
24
  self.content = content
25
25
 
26
- def _write_to_zarr_group(self, group: Group) -> None:
26
+ def write_to_zarr_group(self, group: Group) -> None:
27
27
  """
28
28
  Write the markdown data to a Zarr group
29
29
 
@@ -26,7 +26,7 @@ class MatplotlibFigure(FigpackView):
26
26
  """
27
27
  self.fig = fig
28
28
 
29
- def _write_to_zarr_group(self, group: Group) -> None:
29
+ def write_to_zarr_group(self, group: Group) -> None:
30
30
  """
31
31
  Write the matplotlib figure data to a Zarr group
32
32
 
@@ -0,0 +1,72 @@
1
+ """
2
+ MountainLayout view for figpack - a workspace-style layout container with left panel and split right panel
3
+ """
4
+
5
+ from typing import List
6
+
7
+ from ..core.figpack_view import FigpackView
8
+ from ..core.zarr import Group
9
+ from .MountainLayoutItem import MountainLayoutItem
10
+
11
+
12
+ class MountainLayout(FigpackView):
13
+ """
14
+ A workspace-style layout container view that provides:
15
+ - Left panel with view buttons (top) and control views (bottom)
16
+ - Right panel split into north and south tab workspaces
17
+ - Views can be opened/closed and reopened in either workspace area
18
+ """
19
+
20
+ def __init__(
21
+ self,
22
+ *,
23
+ items: List[MountainLayoutItem],
24
+ ):
25
+ """
26
+ Initialize a MountainLayout view
27
+
28
+ Args:
29
+ items: List of MountainLayoutItem objects containing the child views.
30
+ Control items (is_control=True) will appear in the bottom-left panel.
31
+ Regular items will have buttons in the top-left panel and can be opened
32
+ in the north/south workspaces on the right.
33
+ """
34
+ self.items = items
35
+
36
+ def write_to_zarr_group(self, group: Group) -> None:
37
+ """
38
+ Write the MountainLayout data to a Zarr group
39
+
40
+ This method serializes the mountain layout structure and all its child views
41
+ into a Zarr group format that can be read by the frontend components.
42
+ Each item's view is written to its own subgroup within the main layout group.
43
+
44
+ Args:
45
+ group: Zarr group to write data into
46
+ """
47
+ # Set the view type identifier for the frontend
48
+ group.attrs["view_type"] = "MountainLayout"
49
+
50
+ # Create a list to store metadata for all layout items
51
+ items_metadata = []
52
+
53
+ # Process each mountain layout item
54
+ for i, item in enumerate(self.items):
55
+ # Generate a unique name for this item's subgroup
56
+ item_name = f"mountain_item_{i}"
57
+
58
+ # Store item metadata (label, is_control, etc.) for the frontend
59
+ item_metadata = item.to_dict()
60
+ item_metadata["name"] = item_name
61
+ items_metadata.append(item_metadata)
62
+
63
+ # Create a subgroup for this item's view
64
+ item_group = group.create_group(item_name)
65
+
66
+ # Recursively write the child view to the subgroup
67
+ # This allows any figpack view to be contained within a mountain layout item
68
+ item.view.write_to_zarr_group(item_group)
69
+
70
+ # Store the complete items metadata in the group attributes
71
+ # This will be used by the frontend to render the mountain layout structure
72
+ group.attrs["items"] = items_metadata
@@ -0,0 +1,50 @@
1
+ """
2
+ MountainLayoutItem class for figpack MountainLayout view - represents an item in a mountain layout container
3
+ """
4
+
5
+ from typing import Optional, Union
6
+
7
+ from ..core.figpack_view import FigpackView
8
+
9
+
10
+ class MountainLayoutItem:
11
+ """
12
+ Represents an item in a MountainLayout with label, view, and control properties
13
+ """
14
+
15
+ def __init__(
16
+ self,
17
+ *,
18
+ label: str,
19
+ view: FigpackView,
20
+ is_control: bool = False,
21
+ control_height: Optional[int] = None,
22
+ ):
23
+ """
24
+ Initialize a MountainLayoutItem
25
+
26
+ Args:
27
+ label: The label text to display for this item
28
+ view: The figpack view to be contained in this layout item
29
+ is_control: Whether this item is a control view (shows in bottom-left panel)
30
+ control_height: Height in pixels for control views (optional)
31
+ """
32
+ self.label = label
33
+ self.view = view
34
+ self.is_control = is_control
35
+ self.control_height = control_height
36
+
37
+ def to_dict(self) -> dict:
38
+ """
39
+ Convert the MountainLayoutItem to a dictionary for serialization
40
+
41
+ Returns:
42
+ Dictionary representation of the MountainLayoutItem
43
+ """
44
+ result = {
45
+ "label": self.label,
46
+ "is_control": self.is_control,
47
+ }
48
+ if self.control_height is not None:
49
+ result["control_height"] = self.control_height
50
+ return result
@@ -174,7 +174,7 @@ class MultiChannelTimeseries(FigpackView):
174
174
  else: # len(shape) == 3
175
175
  return (chunk_timepoints, 2, n_channels)
176
176
 
177
- def _write_to_zarr_group(self, group: Group) -> None:
177
+ def write_to_zarr_group(self, group: Group) -> None:
178
178
  """
179
179
  Write the multi-channel timeseries data to a Zarr group
180
180
 
@@ -26,14 +26,14 @@ class PlotlyFigure(figpack.ExtensionView):
26
26
 
27
27
  self.fig = fig
28
28
 
29
- def _write_to_zarr_group(self, group: figpack.Group) -> None:
29
+ def write_to_zarr_group(self, group: figpack.Group) -> None:
30
30
  """
31
31
  Write the plotly figure data to a Zarr group
32
32
 
33
33
  Args:
34
34
  group: Zarr group to write data into
35
35
  """
36
- super()._write_to_zarr_group(group)
36
+ super().write_to_zarr_group(group)
37
37
 
38
38
  # Convert the plotly figure to a dictionary
39
39
  fig_dict = self.fig.to_dict()
@@ -186,7 +186,7 @@ class Spectrogram(FigpackView):
186
186
 
187
187
  return (chunk_timepoints, n_frequencies)
188
188
 
189
- def _write_to_zarr_group(self, group: Group) -> None:
189
+ def write_to_zarr_group(self, group: Group) -> None:
190
190
  """
191
191
  Write the spectrogram data to a Zarr group
192
192
 
figpack/views/Splitter.py CHANGED
@@ -36,7 +36,7 @@ class Splitter(FigpackView):
36
36
  self.item2 = item2
37
37
  self.split_pos = max(0.1, min(0.9, split_pos)) # Clamp between 0.1 and 0.9
38
38
 
39
- def _write_to_zarr_group(self, group: Group) -> None:
39
+ def write_to_zarr_group(self, group: Group) -> None:
40
40
  """
41
41
  Write the Splitter layout data to a Zarr group
42
42
 
@@ -61,7 +61,7 @@ class Splitter(FigpackView):
61
61
 
62
62
  # Create subgroups for each item's view
63
63
  item1_group = group.create_group("item1")
64
- self.item1.view._write_to_zarr_group(item1_group)
64
+ self.item1.view.write_to_zarr_group(item1_group)
65
65
 
66
66
  item2_group = group.create_group("item2")
67
- self.item2.view._write_to_zarr_group(item2_group)
67
+ self.item2.view.write_to_zarr_group(item2_group)
@@ -32,7 +32,7 @@ class TabLayout(FigpackView):
32
32
  max(0, min(initial_tab_index, len(items) - 1)) if items else 0
33
33
  )
34
34
 
35
- def _write_to_zarr_group(self, group: Group) -> None:
35
+ def write_to_zarr_group(self, group: Group) -> None:
36
36
  """
37
37
  Write the TabLayout data to a Zarr group
38
38
 
@@ -61,7 +61,7 @@ class TabLayout(FigpackView):
61
61
  item_group = group.create_group(item_name)
62
62
 
63
63
  # Recursively write the child view to the subgroup
64
- item.view._write_to_zarr_group(item_group)
64
+ item.view.write_to_zarr_group(item_group)
65
65
 
66
66
  # Store the items metadata
67
67
  group.attrs["items"] = items_metadata
@@ -160,7 +160,7 @@ class TimeseriesGraph(FigpackView):
160
160
  )
161
161
  )
162
162
 
163
- def _write_to_zarr_group(self, group: Group) -> None:
163
+ def write_to_zarr_group(self, group: Group) -> None:
164
164
  """
165
165
  Write the graph data to a Zarr group
166
166
 
@@ -170,13 +170,13 @@ class TimeseriesGraph(FigpackView):
170
170
  for series in self._series:
171
171
  series_group = group.create_group(series.name)
172
172
  if isinstance(series, TGLineSeries):
173
- series._write_to_zarr_group(series_group)
173
+ series.write_to_zarr_group(series_group)
174
174
  elif isinstance(series, TGMarkerSeries):
175
- series._write_to_zarr_group(series_group)
175
+ series.write_to_zarr_group(series_group)
176
176
  elif isinstance(series, TGIntervalSeries):
177
- series._write_to_zarr_group(series_group)
177
+ series.write_to_zarr_group(series_group)
178
178
  elif isinstance(series, TGUniformSeries):
179
- series._write_to_zarr_group(series_group)
179
+ series.write_to_zarr_group(series_group)
180
180
  else:
181
181
  raise ValueError(f"Unknown series type: {type(series)}")
182
182
 
@@ -215,7 +215,7 @@ class TGLineSeries:
215
215
  self.width = width
216
216
  self.dash = dash
217
217
 
218
- def _write_to_zarr_group(
218
+ def write_to_zarr_group(
219
219
  self,
220
220
  group: Group,
221
221
  ) -> None:
@@ -248,7 +248,7 @@ class TGMarkerSeries:
248
248
  self.radius = radius
249
249
  self.shape = shape
250
250
 
251
- def _write_to_zarr_group(self, group: Group) -> None:
251
+ def write_to_zarr_group(self, group: Group) -> None:
252
252
  """
253
253
  Write the marker series data to a Zarr dataset
254
254
 
@@ -287,7 +287,7 @@ class TGIntervalSeries:
287
287
  self.color = color
288
288
  self.alpha = alpha
289
289
 
290
- def _write_to_zarr_group(self, group: Group) -> None:
290
+ def write_to_zarr_group(self, group: Group) -> None:
291
291
  """
292
292
  Write the interval series data to a Zarr dataset
293
293
 
@@ -492,7 +492,7 @@ class TGUniformSeries:
492
492
  else: # len(shape) == 3
493
493
  return (chunk_timepoints, 2, n_channels)
494
494
 
495
- def _write_to_zarr_group(self, group: Group) -> None:
495
+ def write_to_zarr_group(self, group: Group) -> None:
496
496
  """
497
497
  Write the uniform series data to a Zarr group
498
498
 
figpack/views/__init__.py CHANGED
@@ -6,6 +6,8 @@ from .Image import Image
6
6
  from .LayoutItem import LayoutItem
7
7
  from .Markdown import Markdown
8
8
  from .MatplotlibFigure import MatplotlibFigure
9
+ from .MountainLayout import MountainLayout
10
+ from .MountainLayoutItem import MountainLayoutItem
9
11
  from .MultiChannelTimeseries import MultiChannelTimeseries
10
12
  from .Spectrogram import Spectrogram
11
13
  from .Splitter import Splitter
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figpack
3
- Version: 0.2.21
3
+ Version: 0.2.23
4
4
  Summary: A Python package for creating shareable, interactive visualizations in the browser
5
5
  Author-email: Jeremy Magland <jmagland@flatironinstitute.org>
6
6
  License: Apache-2.0
@@ -70,6 +70,8 @@ Requires-Dist: sphinx-autobuild>=2021.3.14; extra == "docs"
70
70
  Requires-Dist: linkify-it-py>=2.0; extra == "docs"
71
71
  Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
72
72
  Requires-Dist: lindi; extra == "docs"
73
+ Requires-Dist: nibabel; extra == "docs"
74
+ Requires-Dist: Pillow; extra == "docs"
73
75
  Dynamic: license-file
74
76
 
75
77
  # figpack
@@ -0,0 +1,47 @@
1
+ figpack/__init__.py,sha256=f85A9_sMa531iN6j4yjwBPfkP5QftcXsYoL6NfMDqdg,358
2
+ figpack/cli.py,sha256=s1mGQuFSntxiIvU6OWwHVlM9Cj-l1zMQ3OzFFe1-5ZE,11089
3
+ figpack/extensions.py,sha256=mILB4_F1RHkca4I7t88zh74IX8VCmfT7XFZZT4XYdNw,13009
4
+ figpack/core/__init__.py,sha256=7zU6O1piTk07aeCfbU81QqTgSHIO2n5MZ4LFNmsrtfs,192
5
+ figpack/core/_bundle_utils.py,sha256=LXPbINsm01jkbQeikgx-CauPZYj9uGFFApWwuzDlJPg,9063
6
+ figpack/core/_file_handler.py,sha256=TC4Z23Xy4dKky8BEwyp3Gj4K9-gpnKRiF1u6KkxWprc,6984
7
+ figpack/core/_save_figure.py,sha256=52ny-m1ThGgxY4ZgMn7m33n8A2OCyezj8H8TMvw0Y8Q,1043
8
+ figpack/core/_server_manager.py,sha256=I8PQImUa4C0L6LfIiCnpRnfQT7B-XVseCs80qnUvIlI,12374
9
+ figpack/core/_show_view.py,sha256=noADkomP1ovH-Jb7Bj0unmkPXvS_uOkkCILJSWag1RI,5171
10
+ figpack/core/_upload_bundle.py,sha256=yGngZfa6yzxh3-YDJrLuN5JaMd-egSxv6DWry67iuZY,14831
11
+ figpack/core/_view_figure.py,sha256=GYTgSCWBxi1pR16aBgAYRcEuFcgj0vjsrLIVfy1HYzM,5374
12
+ figpack/core/config.py,sha256=oOR7SlP192vuFhYlS-h14HnG-kd_3gaz0vshXch2RNc,173
13
+ figpack/core/extension_view.py,sha256=FSBXdhFEWicLi0jhkuRdS-a8CNsULrEqqIKtYfV3tmI,1255
14
+ figpack/core/figpack_extension.py,sha256=KSJKlnLYueFnGa8QFMpbIF3CDMwnIZJOqsI0smz6cUc,2252
15
+ figpack/core/figpack_view.py,sha256=TsIvP7PUMwYl5M0G6zZ0xHI0mqkLRltfWj_SNyWVh1w,6454
16
+ figpack/core/zarr.py,sha256=LTWOIX6vuH25STYTQS9_apfnfYXmATAEQkil3z9eYKE,1634
17
+ figpack/figpack-figure-dist/index.html,sha256=1_rZQVk_M3zMcSb6VmiqSyH3yqHiirvOw5XDNE-gJDQ,688
18
+ figpack/figpack-figure-dist/assets/index-CLEO_r6_.js,sha256=4qrioRNRLnfC3Kd0coraHxna05w3sK5lHnebHWv26a0,1108269
19
+ figpack/figpack-figure-dist/assets/index-V5m_wCvw.css,sha256=WRtQLW6SNlTlLtepSOt89t1z41SD7XzYUyRldqowjMM,7286
20
+ figpack/figpack-figure-dist/assets/neurosift-logo-CLsuwLMO.png,sha256=g5m-TwrGh5f6-9rXtWV-znH4B0nHgc__0GWclRDLUHs,9307
21
+ figpack/views/Box.py,sha256=oN_OJH2pK_hH26k0eFCFjlfuJssVqKvw20GxYK1HX7g,2419
22
+ figpack/views/DataFrame.py,sha256=VGspmfWtnZ4Gvea5zd-ODpiJPQEp8gVv-ScDhVVCeyA,3400
23
+ figpack/views/Gallery.py,sha256=15ukt9CmgkbT8q_okEYYDESW1E7vOJkVPombSlrEWKw,3324
24
+ figpack/views/GalleryItem.py,sha256=b_upJno5P3ANSulbG-h3t6Xj56tPGJ7iVxqyiZu3zaQ,1244
25
+ figpack/views/Image.py,sha256=Nc8XNKQBm79iN6omZIsYEU6daNa_X3_IIbmt4q1Zb8k,3741
26
+ figpack/views/LayoutItem.py,sha256=wy8DggkIzZpU0F1zFIBceS7HpBb6lu-A3hpYINQzedk,1595
27
+ figpack/views/Markdown.py,sha256=ojUmeVf7gEh4nUSnbyg62dKNpwgQOLFDYV84w2NS5EQ,1133
28
+ figpack/views/MatplotlibFigure.py,sha256=697xTOkNxcwYZrLoYOzh4CuME4NDUpIYzX-ckLE5aWU,2422
29
+ figpack/views/MountainLayout.py,sha256=JGvrhzqLR2im5d-m0TsZNy06KOR5iGfDlinrRqHpQsQ,2680
30
+ figpack/views/MountainLayoutItem.py,sha256=arYO1pD9RpXfHQKxtFagl66bjqSzEdafIf8ldDEMTD0,1451
31
+ figpack/views/MultiChannelTimeseries.py,sha256=6AkEbAsdM6fvZVsa3jakIjEcx6LNWhF0fbS00e33heM,8291
32
+ figpack/views/Spectrogram.py,sha256=jcm26ucHedKDnBA5xnAUu9tW-g-ZutT-kw1EIhYm66E,9335
33
+ figpack/views/Splitter.py,sha256=BR2L-8aqicTubS1rSzsQ3XnhoJcX5GcfEnVWtEWEs0w,2016
34
+ figpack/views/TabLayout.py,sha256=AqdHPLcP2-caWjxbkC8r8m60z8n_eyZrIBGOOPSVNCs,1908
35
+ figpack/views/TabLayoutItem.py,sha256=xmHA0JsW_6naJze4_mQuP_Fy0Nm17p2N7w_AsmVRp8k,880
36
+ figpack/views/TimeseriesGraph.py,sha256=QL2eVqzB5QiGkIO5-vVf6PD9E0AHffI6VJeWvxsQ9HM,17691
37
+ figpack/views/__init__.py,sha256=V09R6vFRzhY7ANevWomM7muFfUieXZEjGimPiMHpey4,641
38
+ figpack/views/PlotlyExtension/PlotlyExtension.py,sha256=LOFSqbm46UZ7HsHTDxUPnNB33ydYQvEkRVK-TSKkzK4,2149
39
+ figpack/views/PlotlyExtension/__init__.py,sha256=80Wy1mDMWyagjuR99ECxJePIYpRQ6TSyHkB0uZoBZ_0,70
40
+ figpack/views/PlotlyExtension/_plotly_extension.py,sha256=yZjG1NMGlQedeeLdV6TQWpi_NTm5Wfk5eWbXEdZbbFE,1455
41
+ figpack/views/PlotlyExtension/plotly_view.js,sha256=9BjgOPkqGl87SSonnb48nFeQV3UTIi1trpSPxd9qlKo,3055
42
+ figpack-0.2.23.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
+ figpack-0.2.23.dist-info/METADATA,sha256=02jVfnIuE2kIKrbr90w-1rJQkVptz8Yvk3IXT-qn1Kw,4618
44
+ figpack-0.2.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
+ figpack-0.2.23.dist-info/entry_points.txt,sha256=l6d3siH2LxXa8qJGbjAqpIZtI5AkMSyDeoRDCzdrUto,45
46
+ figpack-0.2.23.dist-info/top_level.txt,sha256=lMKGaC5xWmAYBx9Ac1iMokm42KFnJFjmkP2ldyvOo-c,8
47
+ figpack-0.2.23.dist-info/RECORD,,