vitessce 3.7.5__py3-none-any.whl → 3.7.7__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.
vitessce/widget.py CHANGED
@@ -155,7 +155,19 @@ def get_uid_str(uid):
155
155
 
156
156
  # lang: js
157
157
  ESM = """
158
- import { importWithMap } from 'https://unpkg.com/dynamic-importmap@0.1.0';
158
+ let importWithMap;
159
+ try {
160
+ importWithMap = (await import('https://unpkg.com/dynamic-importmap@0.1.0')).importWithMap;
161
+ } catch(e) {
162
+ console.warn("Import of dynamic-importmap failed, trying fallback.");
163
+ importWithMap = (await import('https://cdn.vitessce.io/dynamic-importmap@0.1.0/dist/index.js')).importWithMap;
164
+ }
165
+
166
+ const successfulImportMap = {
167
+ imports: {
168
+
169
+ },
170
+ };
159
171
  const importMap = {
160
172
  imports: {
161
173
  "react": "https://esm.sh/react@18.2.0?dev",
@@ -163,9 +175,64 @@ const importMap = {
163
175
  "react-dom/client": "https://esm.sh/react-dom@18.2.0/client?dev",
164
176
  },
165
177
  };
178
+ const fallbackImportMap = {
179
+ imports: {
180
+ "react": "https://cdn.vitessce.io/react@18.2.0/index.js",
181
+ "react-dom": "https://cdn.vitessce.io/react-dom@18.2.0/index.js",
182
+ "react-dom/client": "https://cdn.vitessce.io/react-dom@18.2.0/es2022/client.mjs",
183
+ // Replaced with version-specific URL below.
184
+ "vitessce": "https://cdn.vitessce.io/vitessce@3.8.5/dist/index.min.js",
185
+ },
186
+ };
187
+ /*
188
+ const fallbackDevImportMap = {
189
+ imports: {
190
+ "react": "https://cdn.vitessce.io/react@18.2.0/index_dev.js",
191
+ "react-dom": "https://cdn.vitessce.io/react-dom@18.2.0/index_dev.js",
192
+ "react-dom/client": "https://cdn.vitessce.io/react-dom@18.2.0/es2022/client.development.mjs",
193
+ // Replaced with version-specific URL below.
194
+ "vitessce": "https://cdn.vitessce.io/@vitessce/dev@3.8.5/dist/index.js",
195
+ },
196
+ };
197
+ */
198
+
199
+ async function importWithMapAndFallback(moduleName, importMap, fallbackMap) {
200
+ let result = null;
201
+ if (!fallbackMap) {
202
+ // fallbackMap is null, user may have provided custom JS URL.
203
+ result = await importWithMap(moduleName, {
204
+ imports: {
205
+ ...importMap.imports,
206
+ ...successfulImportMap.imports,
207
+ },
208
+ });
209
+ successfulImportMap.imports[moduleName] = importMap.imports[moduleName];
210
+ } else {
211
+ try {
212
+ result = await importWithMap(moduleName, {
213
+ imports: {
214
+ ...importMap.imports,
215
+ ...successfulImportMap.imports,
216
+ },
217
+ });
218
+ successfulImportMap.imports[moduleName] = importMap.imports[moduleName];
219
+ } catch (e) {
220
+ console.warn(`Importing ${moduleName} failed with importMap`, importMap, "trying fallback", fallbackMap, successfulImportMap);
221
+ result = await importWithMap(moduleName, {
222
+ imports: {
223
+ ...fallbackMap.imports,
224
+ ...successfulImportMap.imports,
225
+ },
226
+ });
227
+ successfulImportMap.imports[moduleName] = fallbackMap.imports[moduleName];
228
+ }
229
+ }
230
+ return result;
231
+ }
232
+
166
233
 
167
- const React = await importWithMap("react", importMap);
168
- const { createRoot } = await importWithMap("react-dom/client", importMap);
234
+ const React = await importWithMapAndFallback("react", importMap, fallbackImportMap);
235
+ const { createRoot } = await importWithMapAndFallback("react-dom/client", importMap, fallbackImportMap);
169
236
 
170
237
  const e = React.createElement;
171
238
 
@@ -268,10 +335,21 @@ async function render(view) {
268
335
 
269
336
  const pkgName = (jsDevMode ? "@vitessce/dev" : "vitessce");
270
337
 
271
- importMap.imports["vitessce"] = (customJsUrl.length > 0
338
+ const hasCustomJsUrl = customJsUrl.length > 0;
339
+
340
+ importMap.imports["vitessce"] = (hasCustomJsUrl
272
341
  ? customJsUrl
273
342
  : `https://unpkg.com/${pkgName}@${jsPackageVersion}`
274
343
  );
344
+ let fallbackImportMapToUse = null;
345
+ if (!hasCustomJsUrl) {
346
+ fallbackImportMapToUse = fallbackImportMap;
347
+ if (jsDevMode) {
348
+ fallbackImportMapToUse.imports["vitessce"] = `https://cdn.vitessce.io/vitessce@${jsPackageVersion}/dist/index.min.js`;
349
+ } else {
350
+ fallbackImportMapToUse.imports["vitessce"] = `https://cdn.vitessce.io/@vitessce/dev@${jsPackageVersion}/dist/index.js`;
351
+ }
352
+ }
275
353
 
276
354
  const {
277
355
  Vitessce,
@@ -292,7 +370,7 @@ async function render(view) {
292
370
  useComplexCoordinationSecondary,
293
371
  useCoordinationScopes,
294
372
  useCoordinationScopesBy,
295
- } = await importWithMap("vitessce", importMap);
373
+ } = await importWithMapAndFallback("vitessce", importMap, fallbackImportMapToUse);
296
374
 
297
375
  let pluginViewTypes = [];
298
376
  let pluginCoordinationTypes = [];
@@ -651,7 +729,7 @@ class VitessceWidget(anywidget.AnyWidget):
651
729
 
652
730
  next_port = DEFAULT_PORT
653
731
 
654
- js_package_version = Unicode('3.8.3').tag(sync=True)
732
+ js_package_version = Unicode('3.8.5').tag(sync=True)
655
733
  js_dev_mode = Bool(False).tag(sync=True)
656
734
  custom_js_url = Unicode('').tag(sync=True)
657
735
  plugin_esm = List(trait=Unicode(''), default_value=[]).tag(sync=True)
@@ -664,7 +742,7 @@ class VitessceWidget(anywidget.AnyWidget):
664
742
 
665
743
  store_urls = List(trait=Unicode(''), default_value=[]).tag(sync=True)
666
744
 
667
- def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=False, js_package_version='3.8.3', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, prefer_local=True, invoke_timeout=300000, invoke_batched=True, page_mode=False, page_esm=None, prevent_scroll=True, server_host=None):
745
+ def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=False, js_package_version='3.8.5', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, prefer_local=True, invoke_timeout=300000, invoke_batched=True, page_mode=False, page_esm=None, prevent_scroll=True, server_host=None):
668
746
  """
669
747
  Construct a new Vitessce widget. Not intended to be instantiated directly; instead, use ``VitessceConfig.widget``.
670
748
 
@@ -798,7 +876,7 @@ class VitessceWidget(anywidget.AnyWidget):
798
876
  # Launch Vitessce using plain HTML representation (no ipywidgets)
799
877
 
800
878
 
801
- def ipython_display(config, height=600, theme='auto', base_url=None, host_name=None, uid=None, port=None, proxy=False, js_package_version='3.8.3', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, page_mode=False, page_esm=None, server_host=None):
879
+ def ipython_display(config, height=600, theme='auto', base_url=None, host_name=None, uid=None, port=None, proxy=False, js_package_version='3.8.5', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, page_mode=False, page_esm=None, server_host=None):
802
880
  from IPython.display import display, HTML
803
881
  uid_str = "vitessce" + get_uid_str(uid)
804
882
 
vitessce/wrappers.py CHANGED
@@ -74,6 +74,7 @@ class AbstractWrapper:
74
74
  self.routes = []
75
75
  self.is_remote = False # TODO: change to needs_localhost_serving for clarity
76
76
  self.is_store = False # TODO: change to needs_store_registration for clarity
77
+ self.is_zip = False
77
78
  self.file_def_creators = []
78
79
  self.base_dir = None
79
80
  self.stores = {}
@@ -1326,6 +1327,12 @@ class AnnDataWrapper(AbstractWrapper):
1326
1327
  *self.get_local_file_route(dataset_uid, obj_i, self._adata_path, self.local_file_uid),
1327
1328
  *self.get_local_file_route(dataset_uid, obj_i, self._ref_path, self.local_ref_uid)
1328
1329
  ]
1330
+ elif self.is_zip:
1331
+ return [
1332
+ # TODO: modify so that the .zip file extension is used
1333
+ # (not necessary, but could help with debugging or with base_dir mode)
1334
+ *self.get_local_file_route(dataset_uid, obj_i, self._adata_path, self.local_dir_uid)
1335
+ ]
1329
1336
  else:
1330
1337
  return self.get_local_dir_route(dataset_uid, obj_i, self._adata_path, self.local_dir_uid)
1331
1338
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vitessce
3
- Version: 3.7.5
3
+ Version: 3.7.7
4
4
  Summary: Jupyter widget facilitating interactive visualization of spatial single-cell data with Vitessce
5
5
  Project-URL: repository, https://github.com/vitessce/vitessce-python
6
6
  Author-email: Mark Keller <mark_keller@hms.harvard.edu>
@@ -8,8 +8,8 @@ vitessce/repr.py,sha256=qMmefmZ3E-3sRVxeI5q1DTZnfuwbXKiA85eyqk5MCT4,2287
8
8
  vitessce/responses.py,sha256=Z6Wo4AXN-RyzmxMPhSuhpIsHTItHM4GyIgMLGoVEYcU,339
9
9
  vitessce/routes.py,sha256=U8T-L-3QCD_tAbPF8LsUlSMhPWNbyzbLNUnxP9Z9s9o,2140
10
10
  vitessce/utils.py,sha256=obzjj65qsagu60_yuhGc-0jmHO-BW0Y-bDs0FgrBqLY,981
11
- vitessce/widget.py,sha256=QJKneYYvBl_WdLiWo1jDaSYlqsc8UXnXtlJRBqj3yjw,36228
12
- vitessce/wrappers.py,sha256=BcT5hyX0iEIWFxPLKeaXy3PM5yz4WZqqq0AUYPIe4cQ,76621
11
+ vitessce/widget.py,sha256=ndgKqwNLrgYnXnA5pGCu2mgQe0_vF1ZMedWuHDYqPpo,39260
12
+ vitessce/wrappers.py,sha256=WdOQ9w4ElGZH_nKrZAfyrtHxW3iVDzIQ1eqBPlrucj0,76993
13
13
  vitessce/data_utils/__init__.py,sha256=3mWi1lMjoj4_dNbhMOvyE-HEJu0qpMzcmkhfz_5T6n8,361
14
14
  vitessce/data_utils/anndata.py,sha256=iLa5-bRezHgBzL_XCHO7w0pc0RQ4urzZbDsqJbBYeCk,10668
15
15
  vitessce/data_utils/entities.py,sha256=X8enC_TQbgwBzjgD1x53IPS6aVr9wyP0s-NLuYBeMeU,11705
@@ -18,7 +18,7 @@ vitessce/data_utils/ome.py,sha256=te1X933QTRfCm8N5uVXZREShtxDdAEggZZKKEoJdlhU,55
18
18
  vitessce/widget_plugins/__init__.py,sha256=lto2GXnc7KwjIoT-jvzyRYLj0XTJG3uxoX45Hc9EcWA,82
19
19
  vitessce/widget_plugins/demo_plugin.py,sha256=14S7nOxdlKSxIHw9DUcNCN83NE_U1EMPy2D4k0FDues,1797
20
20
  vitessce/widget_plugins/spatial_query.py,sha256=CYxvmMT1Je_jguikPROQxlegkPgIIzemKGbZSJfZMyI,12314
21
- vitessce-3.7.5.dist-info/METADATA,sha256=6eoLOe4wlXUcAEi8hjlBQHp-l5K_XI5MTmTItxJWD_0,9826
22
- vitessce-3.7.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- vitessce-3.7.5.dist-info/licenses/LICENSE,sha256=sNNpI0PQ57AW8_XnTAjU5Yw8YBA_DRNkVHrHYpCIhRU,1067
24
- vitessce-3.7.5.dist-info/RECORD,,
21
+ vitessce-3.7.7.dist-info/METADATA,sha256=iXdHIIrXmQc6KTomDoFxfYRq20FRbN43WYOp46QZ1gY,9826
22
+ vitessce-3.7.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ vitessce-3.7.7.dist-info/licenses/LICENSE,sha256=sNNpI0PQ57AW8_XnTAjU5Yw8YBA_DRNkVHrHYpCIhRU,1067
24
+ vitessce-3.7.7.dist-info/RECORD,,