vitessce 3.6.9__py3-none-any.whl → 3.7.0__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/config.py +24 -0
- vitessce/widget.py +44 -27
- {vitessce-3.6.9.dist-info → vitessce-3.7.0.dist-info}/METADATA +1 -1
- {vitessce-3.6.9.dist-info → vitessce-3.7.0.dist-info}/RECORD +6 -6
- {vitessce-3.6.9.dist-info → vitessce-3.7.0.dist-info}/WHEEL +0 -0
- {vitessce-3.6.9.dist-info → vitessce-3.7.0.dist-info}/licenses/LICENSE +0 -0
vitessce/config.py
CHANGED
|
@@ -925,6 +925,19 @@ class VitessceConfig:
|
|
|
925
925
|
del self.background_servers[port]
|
|
926
926
|
|
|
927
927
|
def stop_all_servers(self):
|
|
928
|
+
"""
|
|
929
|
+
Stop all background servers associated with this config instance.
|
|
930
|
+
|
|
931
|
+
.. code-block:: python
|
|
932
|
+
:emphasize-lines: 5
|
|
933
|
+
|
|
934
|
+
from vitessce import VitessceConfig
|
|
935
|
+
|
|
936
|
+
vc = VitessceConfig(schema_version="1.0.18", name='My Config')
|
|
937
|
+
vw = vc.widget()
|
|
938
|
+
# ... do something with the widget ...
|
|
939
|
+
vc.stop_all_servers()
|
|
940
|
+
"""
|
|
928
941
|
for server in self.background_servers.values():
|
|
929
942
|
server.stop()
|
|
930
943
|
self.background_servers = {}
|
|
@@ -1791,6 +1804,17 @@ class VitessceConfig:
|
|
|
1791
1804
|
:param int height: The height of the widget, in pixels. By default, 600.
|
|
1792
1805
|
:param int port: The port to use when serving data objects on localhost. By default, 8000.
|
|
1793
1806
|
:param bool proxy: Is this widget being served through a proxy, for example with a cloud notebook (e.g. Binder)?
|
|
1807
|
+
:param str js_package_version: The version of the NPM package ('vitessce' if not js_dev_mode else '@vitessce/dev').
|
|
1808
|
+
:param bool js_dev_mode: Should @vitessce/dev be used (typically for debugging purposes)? By default, False.
|
|
1809
|
+
:param str custom_js_url: A URL to a JavaScript file to use (instead of 'vitessce' or '@vitessce/dev' NPM package).
|
|
1810
|
+
:param list[VitesscePlugin] plugins: A list of subclasses of VitesscePlugin. Optional.
|
|
1811
|
+
:param bool remount_on_uid_change: Passed to the remountOnUidChange prop of the <Vitessce/> React component. By default, True.
|
|
1812
|
+
:param bool prefer_local: Should local data be preferred (only applies to `*_artifact` data objects)? By default, True.
|
|
1813
|
+
:param int invoke_timeout: The timeout in milliseconds for invoking Python functions from JavaScript. By default, 300000.
|
|
1814
|
+
:param bool invoke_batched: Should invocations (Zarr gets) be submitted in batch, or individually? By default, True.
|
|
1815
|
+
:param bool page_mode: Whether to render the <Vitessce/> component in grid-mode or page-mode. By default, False.
|
|
1816
|
+
:param str page_esm: The ES module string for the page component creation function. Optional.
|
|
1817
|
+
:param bool prevent_scroll: Should mouseover in the Vitessce widget prevent disable the scrolling of the notebook? By default, True.
|
|
1794
1818
|
|
|
1795
1819
|
:returns: The Jupyter widget.
|
|
1796
1820
|
:rtype: VitessceWidget
|
vitessce/widget.py
CHANGED
|
@@ -445,7 +445,7 @@ async function render(view) {
|
|
|
445
445
|
function VitessceWidget(props) {
|
|
446
446
|
const { model, styleContainer } = props;
|
|
447
447
|
|
|
448
|
-
const [config, setConfig] = React.useState(prependBaseUrl(model.get('
|
|
448
|
+
const [config, setConfig] = React.useState(prependBaseUrl(model.get('_config'), model.get('proxy'), model.get('has_host_name')));
|
|
449
449
|
const [validateConfig, setValidateConfig] = React.useState(true);
|
|
450
450
|
const height = model.get('height');
|
|
451
451
|
const theme = model.get('theme') === 'auto' ? (prefersDark ? 'dark' : 'light') : model.get('theme');
|
|
@@ -484,7 +484,7 @@ async function render(view) {
|
|
|
484
484
|
// Config changed on JS side (from within <Vitessce/>),
|
|
485
485
|
// send updated config to Python side.
|
|
486
486
|
const onConfigChange = React.useCallback((config) => {
|
|
487
|
-
model.set('
|
|
487
|
+
model.set('_config', config);
|
|
488
488
|
setValidateConfig(false);
|
|
489
489
|
model.save_changes();
|
|
490
490
|
}, [model]);
|
|
@@ -492,8 +492,8 @@ async function render(view) {
|
|
|
492
492
|
// Config changed on Python side,
|
|
493
493
|
// pass to <Vitessce/> component to it is updated on JS side.
|
|
494
494
|
React.useEffect(() => {
|
|
495
|
-
model.on('change:
|
|
496
|
-
const newConfig = prependBaseUrl(model.get('
|
|
495
|
+
model.on('change:_config', () => {
|
|
496
|
+
const newConfig = prependBaseUrl(model.get('_config'), model.get('proxy'), model.get('has_host_name'));
|
|
497
497
|
|
|
498
498
|
// Force a re-render and re-validation by setting a new config.uid value.
|
|
499
499
|
// TODO: make this conditional on a parameter from Python.
|
|
@@ -597,8 +597,12 @@ class VitesscePlugin:
|
|
|
597
597
|
"""
|
|
598
598
|
A class that represents a Vitessce widget plugin. Custom plugins can be created by subclassing this class.
|
|
599
599
|
"""
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
|
|
601
|
+
#: The ES module string for the plugin.
|
|
602
|
+
plugin_esm = DEFAULT_PLUGIN_ESM # type: str
|
|
603
|
+
|
|
604
|
+
#: A dictionary mapping command name strings to functions. Functions should take two arguments (message, buffers) and return a tuple (response, buffers).
|
|
605
|
+
commands = {} # type: dict
|
|
602
606
|
|
|
603
607
|
def on_config_change(self, new_config):
|
|
604
608
|
"""
|
|
@@ -614,7 +618,16 @@ class VitesscePlugin:
|
|
|
614
618
|
|
|
615
619
|
class VitessceWidget(anywidget.AnyWidget):
|
|
616
620
|
"""
|
|
617
|
-
A class to represent a Jupyter widget for Vitessce.
|
|
621
|
+
A class to represent a Jupyter widget for Vitessce. Not intended to be instantiated directly; instead, use ``VitessceConfig.widget``.
|
|
622
|
+
|
|
623
|
+
.. code-block:: python
|
|
624
|
+
:emphasize-lines: 4
|
|
625
|
+
|
|
626
|
+
from vitessce import VitessceConfig
|
|
627
|
+
|
|
628
|
+
vc = VitessceConfig.from_object(my_scanpy_object)
|
|
629
|
+
vw = vc.widget()
|
|
630
|
+
vw
|
|
618
631
|
"""
|
|
619
632
|
_esm = ESM
|
|
620
633
|
|
|
@@ -622,7 +635,13 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
622
635
|
# Widget properties are defined as traitlets. Any property tagged with `sync=True`
|
|
623
636
|
# is automatically synced to the frontend *any* time it changes in Python.
|
|
624
637
|
# It is synced back to Python from the frontend *any* time the model is touched.
|
|
625
|
-
|
|
638
|
+
|
|
639
|
+
#: Dictionary representation of the Vitessce JSON configuration. Synced via traitlets upon interactions.
|
|
640
|
+
_config = Dict({}).tag(sync=True) # type: dict
|
|
641
|
+
|
|
642
|
+
#: The VitessceConfig instance used to create this widget. Not synced upon interactions.
|
|
643
|
+
config = None # type: vitessce.config.VitessceConfig
|
|
644
|
+
|
|
626
645
|
height = Int(600).tag(sync=True)
|
|
627
646
|
theme = Unicode('auto').tag(sync=True)
|
|
628
647
|
proxy = Bool(False).tag(sync=True)
|
|
@@ -631,7 +650,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
631
650
|
|
|
632
651
|
next_port = DEFAULT_PORT
|
|
633
652
|
|
|
634
|
-
js_package_version = Unicode('3.6.
|
|
653
|
+
js_package_version = Unicode('3.6.12').tag(sync=True)
|
|
635
654
|
js_dev_mode = Bool(False).tag(sync=True)
|
|
636
655
|
custom_js_url = Unicode('').tag(sync=True)
|
|
637
656
|
plugin_esm = List(trait=Unicode(''), default_value=[]).tag(sync=True)
|
|
@@ -644,9 +663,10 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
644
663
|
|
|
645
664
|
store_urls = List(trait=Unicode(''), default_value=[]).tag(sync=True)
|
|
646
665
|
|
|
647
|
-
def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=False, js_package_version='3.6.
|
|
666
|
+
def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=False, js_package_version='3.6.12', 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):
|
|
667
|
+
""" """
|
|
648
668
|
"""
|
|
649
|
-
Construct a new Vitessce widget.
|
|
669
|
+
Construct a new Vitessce widget. Not intended to be instantiated directly; instead, use ``VitessceConfig.widget``.
|
|
650
670
|
|
|
651
671
|
:param config: A view config instance.
|
|
652
672
|
:type config: VitessceConfig
|
|
@@ -666,19 +686,16 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
666
686
|
:param str page_esm: The ES module string for the page component creation function. Optional.
|
|
667
687
|
:param bool prevent_scroll: Should mouseover in the Vitessce widget prevent disable the scrolling of the notebook? By default, True.
|
|
668
688
|
|
|
669
|
-
|
|
670
|
-
:emphasize-lines: 4
|
|
671
|
-
|
|
672
|
-
from vitessce import VitessceConfig, VitessceWidget
|
|
673
|
-
|
|
674
|
-
vc = VitessceConfig.from_object(my_scanpy_object)
|
|
675
|
-
vw = vc.widget()
|
|
676
|
-
vw
|
|
689
|
+
Note: these parameter docstrings need to be manually kept in sync with the VitessceConfig.widget docstring.
|
|
677
690
|
"""
|
|
678
691
|
|
|
679
692
|
base_url, use_port, VitessceWidget.next_port = get_base_url_and_port(
|
|
680
693
|
port, VitessceWidget.next_port, proxy=proxy)
|
|
681
|
-
|
|
694
|
+
# Note:
|
|
695
|
+
# - self.config is the VitessceConfig instance.
|
|
696
|
+
# - self._config is the JSON configuration, synced via traitlets
|
|
697
|
+
|
|
698
|
+
self.config = config
|
|
682
699
|
self.port = use_port
|
|
683
700
|
config_dict = config.to_dict(base_url=base_url)
|
|
684
701
|
routes = config.get_routes()
|
|
@@ -694,7 +711,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
694
711
|
uid_str = get_uid_str(uid)
|
|
695
712
|
|
|
696
713
|
super(VitessceWidget, self).__init__(
|
|
697
|
-
|
|
714
|
+
_config=config_dict, height=height, theme=theme, proxy=proxy,
|
|
698
715
|
js_package_version=js_package_version, js_dev_mode=js_dev_mode, custom_js_url=custom_js_url,
|
|
699
716
|
plugin_esm=plugin_esm, remount_on_uid_change=remount_on_uid_change,
|
|
700
717
|
page_mode=page_mode, page_esm=('' if page_esm is None else page_esm),
|
|
@@ -712,14 +729,14 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
712
729
|
# It is optional for plugins to implement on_config_change.
|
|
713
730
|
pass
|
|
714
731
|
if new_config is not None:
|
|
715
|
-
self.
|
|
732
|
+
self._config = new_config
|
|
716
733
|
|
|
717
|
-
self.observe(handle_config_change, names=['
|
|
734
|
+
self.observe(handle_config_change, names=['_config'])
|
|
718
735
|
|
|
719
736
|
serve_routes(config, routes, use_port)
|
|
720
737
|
|
|
721
738
|
def _get_coordination_value(self, coordination_type, coordination_scope):
|
|
722
|
-
obj = self.
|
|
739
|
+
obj = self._config['coordinationSpace'][coordination_type]
|
|
723
740
|
obj_scopes = list(obj.keys())
|
|
724
741
|
if coordination_scope is not None:
|
|
725
742
|
if coordination_scope in obj_scopes:
|
|
@@ -742,7 +759,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
742
759
|
return self._get_coordination_value('cellSelection', scope)
|
|
743
760
|
|
|
744
761
|
def close(self):
|
|
745
|
-
self.
|
|
762
|
+
self.config.stop_server(self.port)
|
|
746
763
|
super().close()
|
|
747
764
|
|
|
748
765
|
@anywidget.experimental.command
|
|
@@ -780,7 +797,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
780
797
|
# Launch Vitessce using plain HTML representation (no ipywidgets)
|
|
781
798
|
|
|
782
799
|
|
|
783
|
-
def ipython_display(config, height=600, theme='auto', base_url=None, host_name=None, uid=None, port=None, proxy=False, js_package_version='3.6.
|
|
800
|
+
def ipython_display(config, height=600, theme='auto', base_url=None, host_name=None, uid=None, port=None, proxy=False, js_package_version='3.6.12', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, page_mode=False, page_esm=None):
|
|
784
801
|
from IPython.display import display, HTML
|
|
785
802
|
uid_str = "vitessce" + get_uid_str(uid)
|
|
786
803
|
|
|
@@ -808,7 +825,7 @@ def ipython_display(config, height=600, theme='auto', base_url=None, host_name=N
|
|
|
808
825
|
"has_host_name": host_name is not None,
|
|
809
826
|
"height": height,
|
|
810
827
|
"theme": theme,
|
|
811
|
-
"
|
|
828
|
+
"_config": config_dict,
|
|
812
829
|
"store_urls": [],
|
|
813
830
|
}
|
|
814
831
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vitessce
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.7.0
|
|
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>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
vitessce/__init__.py,sha256=GWGahpQMOGFotQXilRccGT0Bnn3OyoCQUCUphW_DtTI,1632
|
|
2
|
-
vitessce/config.py,sha256=
|
|
2
|
+
vitessce/config.py,sha256=0U10mtZZx_DBKM8AipD1Xw-L1hRgQcfOFASKHSGJ5BE,82949
|
|
3
3
|
vitessce/config_converter.py,sha256=IRPnGPGaETvJbYZNUv2pe54SHHHsDY9VWo3JRjSI5FM,14681
|
|
4
4
|
vitessce/constants.py,sha256=nBMH55TcnSavcpvYE-epyx3cJ0iDS31eHsL_1e9qb9M,15360
|
|
5
5
|
vitessce/export.py,sha256=L7j5sVC0nBSqGocFWQyyHImSiAF4IjXhmqV1QtpuNc4,3874
|
|
@@ -8,7 +8,7 @@ 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=
|
|
11
|
+
vitessce/widget.py,sha256=D4xrcIZWp_nZwaWe9X5rH2EThRBbECt1uYlRGYQpyXk,35898
|
|
12
12
|
vitessce/wrappers.py,sha256=gbJggLGoFTRa1odnBvBDE5EspQ8vc_CpNq_eTbZBGSM,76091
|
|
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
|
|
@@ -18,7 +18,7 @@ vitessce/data_utils/ome.py,sha256=tJHlSHbZTxpjRgYfTxbYMS9zSnSHQwJVWPZpREAvHtU,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.
|
|
22
|
-
vitessce-3.
|
|
23
|
-
vitessce-3.
|
|
24
|
-
vitessce-3.
|
|
21
|
+
vitessce-3.7.0.dist-info/METADATA,sha256=C_3I3Pgll9lUncQxm-jUKm3NA11AQWgcVzYE4yBoWJM,9826
|
|
22
|
+
vitessce-3.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
23
|
+
vitessce-3.7.0.dist-info/licenses/LICENSE,sha256=sNNpI0PQ57AW8_XnTAjU5Yw8YBA_DRNkVHrHYpCIhRU,1067
|
|
24
|
+
vitessce-3.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|