syd 1.0.1__tar.gz → 1.0.2__tar.gz
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.
- {syd-1.0.1 → syd-1.0.2}/PKG-INFO +27 -24
- {syd-1.0.1 → syd-1.0.2}/README.md +26 -23
- {syd-1.0.1 → syd-1.0.2}/syd/__init__.py +1 -1
- {syd-1.0.1 → syd-1.0.2}/syd/viewer.py +51 -3
- {syd-1.0.1 → syd-1.0.2}/.gitignore +0 -0
- {syd-1.0.1 → syd-1.0.2}/LICENSE +0 -0
- {syd-1.0.1 → syd-1.0.2}/pyproject.toml +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/__init__.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/deployer.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/static/__init__.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/static/css/styles.css +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/static/js/viewer.js +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/templates/__init__.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/templates/index.html +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/flask_deployment/testing_principles.md +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/notebook_deployment/__init__.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/notebook_deployment/deployer.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/notebook_deployment/widgets.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/parameters.py +0 -0
- {syd-1.0.1 → syd-1.0.2}/syd/support.py +0 -0
{syd-1.0.1 → syd-1.0.2}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: syd
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A Python package for making GUIs for data science easy.
|
|
5
5
|
Project-URL: Homepage, https://github.com/landoskape/syd
|
|
6
6
|
Author-email: Andrew Landau <andrew+tyler+landau+getridofthisanddtheplusses@gmail.com>
|
|
@@ -47,7 +47,7 @@ Have you ever wanted to look through all your data really quickly interactively?
|
|
|
47
47
|
|
|
48
48
|
Syd is a system for creating a data viewing GUI that you can view in a jupyter notebook or in a web browser. And guess what? Since it can open in a web browser, you can even open it on any other computer on your local network! For example, your PI's computer. Gone are the days of single random examples that they make infinitely stubborn conclusions about. Now, you can look at all the examples, quickly and easily, on their computer. And that's why Syd stands for share your data!
|
|
49
49
|
|
|
50
|
-
Okay, so what is it? Syd is an automated system to convert some basic python plotting code into an interactive GUI. This means you only have to think about
|
|
50
|
+
Okay, so what is it? Syd is an automated system to convert some basic python plotting code into an interactive GUI. This means you only have to think about what you want to _**plot**_ and which _**parameters**_ you want to be interactive. Syd handles all the behind-the-scenes action required to make an interface. And guess what? That means you get to spend your time _**thinking**_ about your data, rather than writing code to look at it. And that's why Syd stands for Science, Yes! Dayummmm!
|
|
51
51
|
|
|
52
52
|
## Installation
|
|
53
53
|
It's easy, just use pip install. The dependencies are light so it should work in most environments.
|
|
@@ -59,10 +59,6 @@ pip install syd
|
|
|
59
59
|
The full documentation is available at [shareyourdata.readthedocs.io](https://shareyourdata.readthedocs.io/). It includes a quick start guide, a comprehensive tutorial, and an API reference for the different elements of Syd. If you have any questions or want to suggest improvements to the docs, please let us know on the [github issues page](https://github.com/landoskape/syd/issues)!
|
|
60
60
|
|
|
61
61
|
## Quick Start
|
|
62
|
-
<!-- <div style="float: right; margin-left: 100px; margin-bottom: 10px;">
|
|
63
|
-
<img src="./docs/assets/viewer_screenshots/readme_example_gif.gif" alt="Syd" width="300" align="right"/>
|
|
64
|
-
</div> -->
|
|
65
|
-
|
|
66
62
|
This is an example of a sine wave viewer which is about as simple as it gets. You can choose which env to use - if you use ``env="notebook"`` then the GUI will deploy as the output of a jupyter cell (this only works in jupyter!). If you use ``env="browser"`` then the GUI will open a page in your default web browser and you can interact with the data there (works in jupyter notebooks and also from python scripts!).
|
|
67
63
|
|
|
68
64
|
```python
|
|
@@ -82,12 +78,13 @@ viewer.add_float("amplitude", value=1.0, min=0.1, max=2.0)
|
|
|
82
78
|
viewer.add_float("frequency", value=1.0, min=0.1, max=5.0)
|
|
83
79
|
viewer.add_selection("color", value="red", options=["red", "blue", "green", "black"])
|
|
84
80
|
|
|
85
|
-
# env = "browser" # for viewing in a web browser
|
|
81
|
+
# env = "browser" # for viewing in a web browser
|
|
86
82
|
env = "notebook" # for viewing within a jupyter notebook
|
|
87
|
-
viewer
|
|
83
|
+
viewer.show()
|
|
88
84
|
```
|
|
89
85
|
|
|
90
86
|

|
|
87
|
+
|
|
91
88
|
### More Examples
|
|
92
89
|
We have several examples of more complex viewers with detailed explanations in the comments. Here are the links and descriptions to each of them:
|
|
93
90
|
|
|
@@ -101,7 +98,7 @@ We have several examples of more complex viewers with detailed explanations in t
|
|
|
101
98
|
|
|
102
99
|
|
|
103
100
|
### Data loading
|
|
104
|
-
Thinking about how to get data into a Syd viewer can be non-intuitive. For some examples that showcase different ways to get your data into a Syd viewer, check out the [data loading example](examples/3-data_loading.ipynb). Or, if you just want a quick example, check this out:
|
|
101
|
+
Thinking about how to get data into a Syd viewer can be non-intuitive. For some examples that showcase different ways to get your data into a Syd viewer, check out the [data loading example](examples/3-data_loading.ipynb). Or, if you just want a quick and fast example, check this one out:
|
|
105
102
|
```python
|
|
106
103
|
import numpy as np
|
|
107
104
|
from matplotlib import pyplot as plt
|
|
@@ -122,15 +119,15 @@ def plot(state):
|
|
|
122
119
|
# Since plot "knows" about the data variable, all you need to do is pass the plot
|
|
123
120
|
# function to the syd viewer and it'll be able to access the data once deployed!
|
|
124
121
|
viewer = make_viewer(plot)
|
|
125
|
-
viewer.
|
|
122
|
+
viewer.show()
|
|
126
123
|
```
|
|
127
124
|
|
|
128
125
|
### Handling Hierarchical Callbacks
|
|
129
|
-
Syd dramatically reduces the amount of work you need to do to build a GUI for viewing your data. However, it can still be a bit complicated to think about callbacks. Below is a quick demonstration
|
|
126
|
+
Syd dramatically reduces the amount of work you need to do to build a GUI for viewing your data. However, it can still be a bit complicated to think about callbacks. Below is a quick demonstration. To try it yourself, check out the full example [here](examples/4-hierarchical_callbacks.ipynb) or open it in colab [](https://colab.research.google.com/github/landoskape/syd/blob/main/examples/4-hierarchical_callbacks.ipynb).
|
|
130
127
|
|
|
131
|
-
For example, suppose your dataset is composed of electrophysiology recordings from 3 mice, where each mouse has a different number of sesssions, and each session has a different number of neurons. You want to build a viewer to
|
|
128
|
+
For example, suppose your dataset is composed of electrophysiology recordings from 3 mice, where each mouse has a different number of sesssions, and each session has a different number of neurons. You want to build a viewer to view a particular neuron from a particular session from a particular mouse. But the viewer will break if you try to index to session 5 for mouse 2 when mouse 2 has less than 5 sessions!
|
|
132
129
|
|
|
133
|
-
This is where hierarchical callbacks come in. There's a straightforward pattern to handling this kind of situation that you can follow. You can write a callback for each **level** of the hierarchy. Then, each callback can call the next callback in the hierarchy. It looks like this:
|
|
130
|
+
This is where hierarchical callbacks come in. There's a straightforward pattern to handling this kind of situation that you can follow. You can write a callback for each **level** of the hierarchy. Then, each callback can **update** the state and call the next callback in the hierarchy once it's finished. It looks like this:
|
|
134
131
|
```python
|
|
135
132
|
import numpy as np
|
|
136
133
|
from syd import Viewer # Much easier to build a Viewer class for hierarchical callbacks
|
|
@@ -141,19 +138,22 @@ class MouseViewer(Viewer):
|
|
|
141
138
|
|
|
142
139
|
self.add_selection("mouse", options=list(mice_names))
|
|
143
140
|
|
|
144
|
-
# We don't know how many sessions or neurons to pick from yet
|
|
141
|
+
# We don't know how many sessions or neurons to pick from yet,
|
|
142
|
+
# so just set the max to 1 for now.
|
|
145
143
|
self.add_integer("session", min=0, max=1)
|
|
146
144
|
self.add_integer("neuron", min=0, max=1)
|
|
147
145
|
|
|
148
|
-
# Any time the mouse changes, update the sessions to pick from
|
|
146
|
+
# Any time the mouse changes, update the sessions to pick from!
|
|
149
147
|
self.on_change("mouse", self.update_mouse)
|
|
150
148
|
|
|
151
|
-
# Any time the session changes, update the neurons to pick from
|
|
149
|
+
# Any time the session changes, update the neurons to pick from!
|
|
152
150
|
self.on_change("session", self.update_session)
|
|
153
151
|
|
|
154
152
|
# Since we built callbacks for setting the range of the session
|
|
155
|
-
# and neuron parameters, we can use them here
|
|
156
|
-
#
|
|
153
|
+
# and neuron parameters, we can use them here so the viewer is
|
|
154
|
+
# fully ready and up to date.
|
|
155
|
+
|
|
156
|
+
# To get the state, use self.state, which is the current
|
|
157
157
|
# state of the viewer (in the init function, it'll just be the
|
|
158
158
|
# default value for each parameter you've added already).
|
|
159
159
|
self.update_mouse(self.state)
|
|
@@ -166,9 +166,13 @@ class MouseViewer(Viewer):
|
|
|
166
166
|
self.update_integer("session", max=num_sessions - 1)
|
|
167
167
|
|
|
168
168
|
# Now we need to update the neurons to choose from ....
|
|
169
|
-
|
|
170
|
-
#
|
|
171
|
-
#
|
|
169
|
+
|
|
170
|
+
# But! Updating the session parameter's max value might trigger a change
|
|
171
|
+
# to the current session value. This ~won't be reflected~ in the state
|
|
172
|
+
# dictionary that was passed to this function.
|
|
173
|
+
|
|
174
|
+
# So, we need to load the ~NEW~ state dictionary, which is always
|
|
175
|
+
# accessible as self.state (or viewer.state if you're not using a class).
|
|
172
176
|
new_state = self.state
|
|
173
177
|
|
|
174
178
|
# Then perform the session update callback!
|
|
@@ -189,7 +193,7 @@ class MouseViewer(Viewer):
|
|
|
189
193
|
|
|
190
194
|
# Now we can create a viewer and deploy it
|
|
191
195
|
viewer = MouseViewer(["Mouse 1", "Mouse 2", "Mouse 3"])
|
|
192
|
-
viewer.
|
|
196
|
+
viewer.show()
|
|
193
197
|
```
|
|
194
198
|
|
|
195
199
|
## License
|
|
@@ -224,5 +228,4 @@ black . # from the root directory of the repo
|
|
|
224
228
|
- [ ] Consider "app_deployed" context for each deployer...
|
|
225
229
|
- Export options:
|
|
226
230
|
- [ ] Export lite: export the viewer as a HTML/Java package that contains an incomplete set of renderings of figures -- using a certain set of parameters.
|
|
227
|
-
- [ ] Export full: export the viewer in a way that contains the data to give full functionality.
|
|
228
|
-
- [ ] Keep deploy() for backwards compatibility, but deprecate it in favor of show() and share() (for notebook and browser, respectively)
|
|
231
|
+
- [ ] Export full: export the viewer in a way that contains the data to give full functionality.
|
|
@@ -17,7 +17,7 @@ Have you ever wanted to look through all your data really quickly interactively?
|
|
|
17
17
|
|
|
18
18
|
Syd is a system for creating a data viewing GUI that you can view in a jupyter notebook or in a web browser. And guess what? Since it can open in a web browser, you can even open it on any other computer on your local network! For example, your PI's computer. Gone are the days of single random examples that they make infinitely stubborn conclusions about. Now, you can look at all the examples, quickly and easily, on their computer. And that's why Syd stands for share your data!
|
|
19
19
|
|
|
20
|
-
Okay, so what is it? Syd is an automated system to convert some basic python plotting code into an interactive GUI. This means you only have to think about
|
|
20
|
+
Okay, so what is it? Syd is an automated system to convert some basic python plotting code into an interactive GUI. This means you only have to think about what you want to _**plot**_ and which _**parameters**_ you want to be interactive. Syd handles all the behind-the-scenes action required to make an interface. And guess what? That means you get to spend your time _**thinking**_ about your data, rather than writing code to look at it. And that's why Syd stands for Science, Yes! Dayummmm!
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
It's easy, just use pip install. The dependencies are light so it should work in most environments.
|
|
@@ -29,10 +29,6 @@ pip install syd
|
|
|
29
29
|
The full documentation is available at [shareyourdata.readthedocs.io](https://shareyourdata.readthedocs.io/). It includes a quick start guide, a comprehensive tutorial, and an API reference for the different elements of Syd. If you have any questions or want to suggest improvements to the docs, please let us know on the [github issues page](https://github.com/landoskape/syd/issues)!
|
|
30
30
|
|
|
31
31
|
## Quick Start
|
|
32
|
-
<!-- <div style="float: right; margin-left: 100px; margin-bottom: 10px;">
|
|
33
|
-
<img src="./docs/assets/viewer_screenshots/readme_example_gif.gif" alt="Syd" width="300" align="right"/>
|
|
34
|
-
</div> -->
|
|
35
|
-
|
|
36
32
|
This is an example of a sine wave viewer which is about as simple as it gets. You can choose which env to use - if you use ``env="notebook"`` then the GUI will deploy as the output of a jupyter cell (this only works in jupyter!). If you use ``env="browser"`` then the GUI will open a page in your default web browser and you can interact with the data there (works in jupyter notebooks and also from python scripts!).
|
|
37
33
|
|
|
38
34
|
```python
|
|
@@ -52,12 +48,13 @@ viewer.add_float("amplitude", value=1.0, min=0.1, max=2.0)
|
|
|
52
48
|
viewer.add_float("frequency", value=1.0, min=0.1, max=5.0)
|
|
53
49
|
viewer.add_selection("color", value="red", options=["red", "blue", "green", "black"])
|
|
54
50
|
|
|
55
|
-
# env = "browser" # for viewing in a web browser
|
|
51
|
+
# env = "browser" # for viewing in a web browser
|
|
56
52
|
env = "notebook" # for viewing within a jupyter notebook
|
|
57
|
-
viewer
|
|
53
|
+
viewer.show()
|
|
58
54
|
```
|
|
59
55
|
|
|
60
56
|

|
|
57
|
+
|
|
61
58
|
### More Examples
|
|
62
59
|
We have several examples of more complex viewers with detailed explanations in the comments. Here are the links and descriptions to each of them:
|
|
63
60
|
|
|
@@ -71,7 +68,7 @@ We have several examples of more complex viewers with detailed explanations in t
|
|
|
71
68
|
|
|
72
69
|
|
|
73
70
|
### Data loading
|
|
74
|
-
Thinking about how to get data into a Syd viewer can be non-intuitive. For some examples that showcase different ways to get your data into a Syd viewer, check out the [data loading example](examples/3-data_loading.ipynb). Or, if you just want a quick example, check this out:
|
|
71
|
+
Thinking about how to get data into a Syd viewer can be non-intuitive. For some examples that showcase different ways to get your data into a Syd viewer, check out the [data loading example](examples/3-data_loading.ipynb). Or, if you just want a quick and fast example, check this one out:
|
|
75
72
|
```python
|
|
76
73
|
import numpy as np
|
|
77
74
|
from matplotlib import pyplot as plt
|
|
@@ -92,15 +89,15 @@ def plot(state):
|
|
|
92
89
|
# Since plot "knows" about the data variable, all you need to do is pass the plot
|
|
93
90
|
# function to the syd viewer and it'll be able to access the data once deployed!
|
|
94
91
|
viewer = make_viewer(plot)
|
|
95
|
-
viewer.
|
|
92
|
+
viewer.show()
|
|
96
93
|
```
|
|
97
94
|
|
|
98
95
|
### Handling Hierarchical Callbacks
|
|
99
|
-
Syd dramatically reduces the amount of work you need to do to build a GUI for viewing your data. However, it can still be a bit complicated to think about callbacks. Below is a quick demonstration
|
|
96
|
+
Syd dramatically reduces the amount of work you need to do to build a GUI for viewing your data. However, it can still be a bit complicated to think about callbacks. Below is a quick demonstration. To try it yourself, check out the full example [here](examples/4-hierarchical_callbacks.ipynb) or open it in colab [](https://colab.research.google.com/github/landoskape/syd/blob/main/examples/4-hierarchical_callbacks.ipynb).
|
|
100
97
|
|
|
101
|
-
For example, suppose your dataset is composed of electrophysiology recordings from 3 mice, where each mouse has a different number of sesssions, and each session has a different number of neurons. You want to build a viewer to
|
|
98
|
+
For example, suppose your dataset is composed of electrophysiology recordings from 3 mice, where each mouse has a different number of sesssions, and each session has a different number of neurons. You want to build a viewer to view a particular neuron from a particular session from a particular mouse. But the viewer will break if you try to index to session 5 for mouse 2 when mouse 2 has less than 5 sessions!
|
|
102
99
|
|
|
103
|
-
This is where hierarchical callbacks come in. There's a straightforward pattern to handling this kind of situation that you can follow. You can write a callback for each **level** of the hierarchy. Then, each callback can call the next callback in the hierarchy. It looks like this:
|
|
100
|
+
This is where hierarchical callbacks come in. There's a straightforward pattern to handling this kind of situation that you can follow. You can write a callback for each **level** of the hierarchy. Then, each callback can **update** the state and call the next callback in the hierarchy once it's finished. It looks like this:
|
|
104
101
|
```python
|
|
105
102
|
import numpy as np
|
|
106
103
|
from syd import Viewer # Much easier to build a Viewer class for hierarchical callbacks
|
|
@@ -111,19 +108,22 @@ class MouseViewer(Viewer):
|
|
|
111
108
|
|
|
112
109
|
self.add_selection("mouse", options=list(mice_names))
|
|
113
110
|
|
|
114
|
-
# We don't know how many sessions or neurons to pick from yet
|
|
111
|
+
# We don't know how many sessions or neurons to pick from yet,
|
|
112
|
+
# so just set the max to 1 for now.
|
|
115
113
|
self.add_integer("session", min=0, max=1)
|
|
116
114
|
self.add_integer("neuron", min=0, max=1)
|
|
117
115
|
|
|
118
|
-
# Any time the mouse changes, update the sessions to pick from
|
|
116
|
+
# Any time the mouse changes, update the sessions to pick from!
|
|
119
117
|
self.on_change("mouse", self.update_mouse)
|
|
120
118
|
|
|
121
|
-
# Any time the session changes, update the neurons to pick from
|
|
119
|
+
# Any time the session changes, update the neurons to pick from!
|
|
122
120
|
self.on_change("session", self.update_session)
|
|
123
121
|
|
|
124
122
|
# Since we built callbacks for setting the range of the session
|
|
125
|
-
# and neuron parameters, we can use them here
|
|
126
|
-
#
|
|
123
|
+
# and neuron parameters, we can use them here so the viewer is
|
|
124
|
+
# fully ready and up to date.
|
|
125
|
+
|
|
126
|
+
# To get the state, use self.state, which is the current
|
|
127
127
|
# state of the viewer (in the init function, it'll just be the
|
|
128
128
|
# default value for each parameter you've added already).
|
|
129
129
|
self.update_mouse(self.state)
|
|
@@ -136,9 +136,13 @@ class MouseViewer(Viewer):
|
|
|
136
136
|
self.update_integer("session", max=num_sessions - 1)
|
|
137
137
|
|
|
138
138
|
# Now we need to update the neurons to choose from ....
|
|
139
|
-
|
|
140
|
-
#
|
|
141
|
-
#
|
|
139
|
+
|
|
140
|
+
# But! Updating the session parameter's max value might trigger a change
|
|
141
|
+
# to the current session value. This ~won't be reflected~ in the state
|
|
142
|
+
# dictionary that was passed to this function.
|
|
143
|
+
|
|
144
|
+
# So, we need to load the ~NEW~ state dictionary, which is always
|
|
145
|
+
# accessible as self.state (or viewer.state if you're not using a class).
|
|
142
146
|
new_state = self.state
|
|
143
147
|
|
|
144
148
|
# Then perform the session update callback!
|
|
@@ -159,7 +163,7 @@ class MouseViewer(Viewer):
|
|
|
159
163
|
|
|
160
164
|
# Now we can create a viewer and deploy it
|
|
161
165
|
viewer = MouseViewer(["Mouse 1", "Mouse 2", "Mouse 3"])
|
|
162
|
-
viewer.
|
|
166
|
+
viewer.show()
|
|
163
167
|
```
|
|
164
168
|
|
|
165
169
|
## License
|
|
@@ -194,5 +198,4 @@ black . # from the root directory of the repo
|
|
|
194
198
|
- [ ] Consider "app_deployed" context for each deployer...
|
|
195
199
|
- Export options:
|
|
196
200
|
- [ ] Export lite: export the viewer as a HTML/Java package that contains an incomplete set of renderings of figures -- using a certain set of parameters.
|
|
197
|
-
- [ ] Export full: export the viewer in a way that contains the data to give full functionality.
|
|
198
|
-
- [ ] Keep deploy() for backwards compatibility, but deprecate it in favor of show() and share() (for notebook and browser, respectively)
|
|
201
|
+
- [ ] Export full: export the viewer in a way that contains the data to give full functionality.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List, Any, Callable, Dict, Tuple, Union, Optional
|
|
1
|
+
from typing import List, Any, Callable, Dict, Tuple, Union, Optional, Literal
|
|
2
2
|
from functools import wraps, partial
|
|
3
3
|
import inspect
|
|
4
4
|
from contextlib import contextmanager
|
|
@@ -212,6 +212,54 @@ class Viewer:
|
|
|
212
212
|
"""Set the plot method for the viewer"""
|
|
213
213
|
self.plot = self._prepare_function(func, context="Setting plot:")
|
|
214
214
|
|
|
215
|
+
def show(
|
|
216
|
+
self,
|
|
217
|
+
controls_position: Literal["left", "top", "right", "bottom"] = "left",
|
|
218
|
+
controls_width_percent: int = 20,
|
|
219
|
+
continuous: bool = False,
|
|
220
|
+
suppress_warnings: bool = True,
|
|
221
|
+
update_threshold: float = 1.0,
|
|
222
|
+
):
|
|
223
|
+
"""Show the viewer in a notebook
|
|
224
|
+
|
|
225
|
+
Same as deploy(env="notebook") except it doesn't return the viewer object.
|
|
226
|
+
"""
|
|
227
|
+
_ = self.deploy(
|
|
228
|
+
env="notebook",
|
|
229
|
+
controls_position=controls_position,
|
|
230
|
+
controls_width_percent=controls_width_percent,
|
|
231
|
+
continuous=continuous,
|
|
232
|
+
suppress_warnings=suppress_warnings,
|
|
233
|
+
update_threshold=update_threshold,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
def share(
|
|
237
|
+
self,
|
|
238
|
+
controls_position: str = "left",
|
|
239
|
+
fig_dpi: int = 300,
|
|
240
|
+
controls_width_percent: int = 20,
|
|
241
|
+
suppress_warnings: bool = True,
|
|
242
|
+
debug: bool = False,
|
|
243
|
+
host: str = "127.0.0.1",
|
|
244
|
+
port: Optional[int] = None,
|
|
245
|
+
open_browser: bool = True,
|
|
246
|
+
):
|
|
247
|
+
"""Share the viewer on a web browser using Flask
|
|
248
|
+
|
|
249
|
+
Same as deploy(env="browser") except it doesn't return the viewer object.
|
|
250
|
+
"""
|
|
251
|
+
_ = self.deploy(
|
|
252
|
+
env="browser",
|
|
253
|
+
controls_position=controls_position,
|
|
254
|
+
fig_dpi=fig_dpi,
|
|
255
|
+
controls_width_percent=controls_width_percent,
|
|
256
|
+
suppress_warnings=suppress_warnings,
|
|
257
|
+
debug=debug,
|
|
258
|
+
host=host,
|
|
259
|
+
port=port,
|
|
260
|
+
open_browser=open_browser,
|
|
261
|
+
)
|
|
262
|
+
|
|
215
263
|
def deploy(self, env: str = "notebook", **kwargs):
|
|
216
264
|
"""Deploy the app in a notebook or standalone environment"""
|
|
217
265
|
env = env.lower()
|
|
@@ -223,7 +271,7 @@ class Viewer:
|
|
|
223
271
|
deployer.deploy()
|
|
224
272
|
return self
|
|
225
273
|
|
|
226
|
-
elif env == "browser"
|
|
274
|
+
elif env == "browser":
|
|
227
275
|
# On demand import because the deployers need to import the viewer
|
|
228
276
|
from .flask_deployment.deployer import FlaskDeployer
|
|
229
277
|
|
|
@@ -238,7 +286,7 @@ class Viewer:
|
|
|
238
286
|
|
|
239
287
|
else:
|
|
240
288
|
raise ValueError(
|
|
241
|
-
f"Unsupported environment: {env}, only 'notebook', '
|
|
289
|
+
f"Unsupported environment: {env}, only 'notebook', 'browser' are supported right now."
|
|
242
290
|
)
|
|
243
291
|
|
|
244
292
|
@contextmanager
|
|
File without changes
|
{syd-1.0.1 → syd-1.0.2}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|