figpack 0.2.21__py3-none-any.whl → 0.2.22__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 CHANGED
@@ -2,7 +2,7 @@
2
2
  figpack - A Python package for creating shareable, interactive visualizations in the browser
3
3
  """
4
4
 
5
- __version__ = "0.2.21"
5
+ __version__ = "0.2.22"
6
6
 
7
7
  from .cli import view_figure
8
8
  from .core import FigpackView, FigpackExtension, ExtensionView
@@ -58,7 +58,7 @@ def prepare_figure_bundle(
58
58
  # Write the view data to the Zarr group
59
59
  zarr_group = zarr.open_group(pathlib.Path(tmpdir) / "data.zarr", mode="w")
60
60
  zarr_group = Group(zarr_group)
61
- view._write_to_zarr_group(zarr_group)
61
+ view.write_to_zarr_group(zarr_group)
62
62
 
63
63
  # Add title and description as attributes on the top-level zarr group
64
64
  zarr_group.attrs["title"] = title
@@ -3,9 +3,7 @@ import json
3
3
  import pathlib
4
4
  import threading
5
5
  import time
6
- import uuid
7
6
  from concurrent.futures import ThreadPoolExecutor, as_completed
8
- from datetime import datetime, timedelta, timezone
9
7
 
10
8
  import requests
11
9
 
@@ -23,10 +23,10 @@ class ExtensionView(FigpackView):
23
23
  self.extension = extension
24
24
  self.view_type = view_type
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 extension view metadata to a Zarr group.
29
- Subclasses should call super()._write_to_zarr_group(group) first,
29
+ Subclasses should call super().write_to_zarr_group(group) first,
30
30
  then add their own data.
31
31
 
32
32
  Args:
@@ -62,11 +62,14 @@ class FigpackView:
62
62
  if upload is None:
63
63
  upload = os.environ.get("FIGPACK_UPLOAD") == "1"
64
64
  else:
65
- if upload is True and ephemeral is True:
66
- # ephemeral is reserved for the case where we don't specify upload
67
- # and we are in a notebook in a remote environment such as
68
- # colab or jupyterhub
69
- raise ValueError("ephemeral cannot be set if upload is set")
65
+ if upload is True:
66
+ if ephemeral is True:
67
+ # ephemeral is reserved for the case where we don't specify upload
68
+ # and we are in a notebook in a remote environment such as
69
+ # colab or jupyterhub
70
+ raise ValueError("ephemeral cannot be set if upload is set")
71
+ else:
72
+ ephemeral = False # if we excplicitly set upload=True, force ephemeral=False
70
73
 
71
74
  # determine inline
72
75
  if inline is None:
@@ -155,11 +158,11 @@ class FigpackView:
155
158
 
156
159
  _save_figure(self, output_path, title=title)
157
160
 
158
- def _write_to_zarr_group(self, group: Group) -> None:
161
+ def write_to_zarr_group(self, group: Group) -> None:
159
162
  """
160
163
  Write the view data to a Zarr group. Must be implemented by subclasses.
161
164
 
162
165
  Args:
163
166
  group: Zarr group to write data into
164
167
  """
165
- raise NotImplementedError("Subclasses must implement _write_to_zarr_group")
168
+ raise NotImplementedError("Subclasses must implement write_to_zarr_group")