figpack 0.2.5__py3-none-any.whl → 0.2.6__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.
- figpack/__init__.py +1 -1
- figpack/core/_bundle_utils.py +2 -2
- figpack/core/_save_figure.py +3 -3
- figpack/core/_show_view.py +5 -1
- figpack/core/_upload_bundle.py +17 -1
- figpack/core/figpack_view.py +3 -3
- figpack/{figpack-gui-dist/assets/index-CrYQmIda.js → figpack-figure-dist/assets/index-HXdk2TtM.js} +56 -56
- figpack/{figpack-gui-dist → figpack-figure-dist}/index.html +1 -1
- figpack/spike_sorting/views/Autocorrelograms.py +29 -19
- figpack/spike_sorting/views/CrossCorrelograms.py +29 -19
- figpack/spike_sorting/views/UnitsTable.py +27 -8
- figpack/views/Markdown.py +12 -2
- figpack/views/MatplotlibFigure.py +26 -3
- figpack/views/PlotlyFigure.py +18 -2
- {figpack-0.2.5.dist-info → figpack-0.2.6.dist-info}/METADATA +1 -1
- {figpack-0.2.5.dist-info → figpack-0.2.6.dist-info}/RECORD +22 -22
- /figpack/{figpack-gui-dist → figpack-figure-dist}/assets/index-Cmae55E4.css +0 -0
- /figpack/{figpack-gui-dist → figpack-figure-dist}/assets/neurosift-logo-CLsuwLMO.png +0 -0
- {figpack-0.2.5.dist-info → figpack-0.2.6.dist-info}/WHEEL +0 -0
- {figpack-0.2.5.dist-info → figpack-0.2.6.dist-info}/entry_points.txt +0 -0
- {figpack-0.2.5.dist-info → figpack-0.2.6.dist-info}/licenses/LICENSE +0 -0
- {figpack-0.2.5.dist-info → figpack-0.2.6.dist-info}/top_level.txt +0 -0
figpack/__init__.py
CHANGED
figpack/core/_bundle_utils.py
CHANGED
|
@@ -15,7 +15,7 @@ def prepare_figure_bundle(
|
|
|
15
15
|
Prepare a figure bundle in the specified temporary directory.
|
|
16
16
|
|
|
17
17
|
This function:
|
|
18
|
-
1. Copies all files from the figpack-
|
|
18
|
+
1. Copies all files from the figpack-figure-dist directory to tmpdir
|
|
19
19
|
2. Writes the view data to a zarr group
|
|
20
20
|
3. Consolidates zarr metadata
|
|
21
21
|
|
|
@@ -25,7 +25,7 @@ def prepare_figure_bundle(
|
|
|
25
25
|
title: Title for the figure (required)
|
|
26
26
|
description: Optional description for the figure (markdown supported)
|
|
27
27
|
"""
|
|
28
|
-
html_dir = thisdir / ".." / "figpack-
|
|
28
|
+
html_dir = thisdir / ".." / "figpack-figure-dist"
|
|
29
29
|
if not os.path.exists(html_dir):
|
|
30
30
|
raise SystemExit(f"Error: directory not found: {html_dir}")
|
|
31
31
|
|
figpack/core/_save_figure.py
CHANGED
|
@@ -5,7 +5,7 @@ from ._bundle_utils import prepare_figure_bundle
|
|
|
5
5
|
from .figpack_view import FigpackView
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def _save_figure(view: FigpackView, output_path: str):
|
|
8
|
+
def _save_figure(view: FigpackView, output_path: str, *, title: str):
|
|
9
9
|
"""
|
|
10
10
|
Save the figure to a folder or a .tar.gz file
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ def _save_figure(view: FigpackView, output_path: str):
|
|
|
19
19
|
):
|
|
20
20
|
# It's a .tar.gz file
|
|
21
21
|
with tempfile.TemporaryDirectory(prefix="figpack_save_") as tmpdir:
|
|
22
|
-
prepare_figure_bundle(view, tmpdir)
|
|
22
|
+
prepare_figure_bundle(view, tmpdir, title=title)
|
|
23
23
|
# Create tar.gz file
|
|
24
24
|
import tarfile
|
|
25
25
|
|
|
@@ -28,4 +28,4 @@ def _save_figure(view: FigpackView, output_path: str):
|
|
|
28
28
|
else:
|
|
29
29
|
# It's a folder
|
|
30
30
|
output_path.mkdir(parents=True, exist_ok=True)
|
|
31
|
-
prepare_figure_bundle(view, str(output_path))
|
|
31
|
+
prepare_figure_bundle(view, str(output_path), title=title)
|
figpack/core/_show_view.py
CHANGED
|
@@ -110,7 +110,11 @@ def _show_view(
|
|
|
110
110
|
|
|
111
111
|
# Upload the bundle
|
|
112
112
|
figure_url = _upload_bundle(
|
|
113
|
-
tmpdir,
|
|
113
|
+
tmpdir,
|
|
114
|
+
api_key,
|
|
115
|
+
title=title,
|
|
116
|
+
ephemeral=ephemeral,
|
|
117
|
+
use_consolidated_metadata_only=True,
|
|
114
118
|
)
|
|
115
119
|
|
|
116
120
|
if inline:
|
figpack/core/_upload_bundle.py
CHANGED
|
@@ -253,10 +253,22 @@ def _finalize_figure(figure_url: str, api_key: str) -> dict:
|
|
|
253
253
|
|
|
254
254
|
|
|
255
255
|
def _upload_bundle(
|
|
256
|
-
tmpdir: str,
|
|
256
|
+
tmpdir: str,
|
|
257
|
+
api_key: str,
|
|
258
|
+
title: str = None,
|
|
259
|
+
ephemeral: bool = False,
|
|
260
|
+
use_consolidated_metadata_only: bool = False,
|
|
257
261
|
) -> str:
|
|
258
262
|
"""
|
|
259
263
|
Upload the prepared bundle to the cloud using the new database-driven approach
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
tmpdir: Path to the temporary directory containing the bundle
|
|
267
|
+
api_key: API key for authentication
|
|
268
|
+
title: Optional title for the figure
|
|
269
|
+
ephemeral: Whether to create an ephemeral figure
|
|
270
|
+
use_consolidated_metadata_only: If True, excludes individual zarr metadata files
|
|
271
|
+
(.zgroup, .zarray, .zattrs) since they are included in .zmetadata
|
|
260
272
|
"""
|
|
261
273
|
tmpdir_path = pathlib.Path(tmpdir)
|
|
262
274
|
|
|
@@ -268,6 +280,10 @@ def _upload_bundle(
|
|
|
268
280
|
for file_path in tmpdir_path.rglob("*"):
|
|
269
281
|
if file_path.is_file():
|
|
270
282
|
relative_path = file_path.relative_to(tmpdir_path)
|
|
283
|
+
# Skip individual zarr metadata files if using consolidated metadata only
|
|
284
|
+
if use_consolidated_metadata_only:
|
|
285
|
+
if str(relative_path).endswith((".zgroup", ".zarray", ".zattrs")):
|
|
286
|
+
continue
|
|
271
287
|
all_files.append((str(relative_path), file_path))
|
|
272
288
|
|
|
273
289
|
# Calculate total files and size for metadata
|
figpack/core/figpack_view.py
CHANGED
|
@@ -121,7 +121,7 @@ class FigpackView:
|
|
|
121
121
|
)
|
|
122
122
|
print("** Development mode **")
|
|
123
123
|
print(
|
|
124
|
-
f"For development, run figpack-
|
|
124
|
+
f"For development, run figpack-figure in dev mode and use http://localhost:5173?data=http://localhost:{port}/{_local_figure_name}/data.zarr"
|
|
125
125
|
)
|
|
126
126
|
print("")
|
|
127
127
|
|
|
@@ -140,7 +140,7 @@ class FigpackView:
|
|
|
140
140
|
_local_figure_name=_local_figure_name if _dev else None,
|
|
141
141
|
)
|
|
142
142
|
|
|
143
|
-
def save(self, output_path: str) -> None:
|
|
143
|
+
def save(self, output_path: str, *, title: str) -> None:
|
|
144
144
|
"""
|
|
145
145
|
Save as figure either to a folder or to a .tar.gz file
|
|
146
146
|
Args:
|
|
@@ -148,7 +148,7 @@ class FigpackView:
|
|
|
148
148
|
"""
|
|
149
149
|
from ._save_figure import _save_figure
|
|
150
150
|
|
|
151
|
-
_save_figure(self, output_path)
|
|
151
|
+
_save_figure(self, output_path, title=title)
|
|
152
152
|
|
|
153
153
|
def _write_to_zarr_group(self, group: zarr.Group) -> None:
|
|
154
154
|
"""
|