syd 0.1.6__tar.gz → 0.2.0__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-0.2.0/PKG-INFO +126 -0
- syd-0.2.0/README.md +96 -0
- {syd-0.1.6 → syd-0.2.0}/pyproject.toml +13 -4
- {syd-0.1.6 → syd-0.2.0}/syd/__init__.py +3 -3
- syd-0.2.0/syd/flask_deployment/__init__.py +7 -0
- syd-0.2.0/syd/flask_deployment/deployer.py +641 -0
- syd-0.2.0/syd/flask_deployment/static/__init__.py +1 -0
- syd-0.2.0/syd/flask_deployment/static/css/styles.css +246 -0
- syd-0.2.0/syd/flask_deployment/static/js/viewer.js +744 -0
- syd-0.2.0/syd/flask_deployment/templates/__init__.py +1 -0
- syd-0.2.0/syd/flask_deployment/templates/index.html +34 -0
- syd-0.2.0/syd/flask_deployment/testing_principles.md +300 -0
- syd-0.2.0/syd/notebook_deployment/__init__.py +1 -0
- {syd-0.1.6 → syd-0.2.0}/syd/notebook_deployment/deployer.py +139 -53
- {syd-0.1.6 → syd-0.2.0}/syd/notebook_deployment/widgets.py +214 -123
- {syd-0.1.6 → syd-0.2.0}/syd/parameters.py +295 -393
- syd-0.2.0/syd/support.py +168 -0
- syd-0.1.6/syd/interactive_viewer.py → syd-0.2.0/syd/viewer.py +393 -470
- syd-0.1.6/PKG-INFO +0 -106
- syd-0.1.6/README.md +0 -79
- syd-0.1.6/syd/flask_deployment/__init__.py +0 -0
- syd-0.1.6/syd/flask_deployment/components.py +0 -497
- syd-0.1.6/syd/flask_deployment/deployer.py +0 -338
- syd-0.1.6/syd/flask_deployment/static/css/styles.css +0 -39
- syd-0.1.6/syd/flask_deployment/static/js/components.js +0 -51
- syd-0.1.6/syd/flask_deployment/static/js/viewer.js +0 -0
- syd-0.1.6/syd/flask_deployment/templates/base.html +0 -26
- syd-0.1.6/syd/flask_deployment/templates/viewer.html +0 -97
- syd-0.1.6/syd/notebook_deployment/__init__.py +0 -1
- {syd-0.1.6 → syd-0.2.0}/.gitignore +0 -0
- {syd-0.1.6 → syd-0.2.0}/LICENSE +0 -0
syd-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: syd
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Python package for making GUIs for data science easy.
|
|
5
|
+
Project-URL: Homepage, https://github.com/landoskape/syd
|
|
6
|
+
Author-email: Andrew Landau <andrew+tyler+landau+getridofthisanddtheplusses@gmail.com>
|
|
7
|
+
License-Expression: GPL-3.0-or-later
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: data-science,gui,interactive,jupyter,machine-learning,notebook,python
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Requires-Dist: flask
|
|
22
|
+
Requires-Dist: ipykernel
|
|
23
|
+
Requires-Dist: ipympl
|
|
24
|
+
Requires-Dist: ipywidgets
|
|
25
|
+
Requires-Dist: matplotlib
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
28
|
+
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Syd
|
|
32
|
+
|
|
33
|
+
[](https://badge.fury.io/py/syd)
|
|
34
|
+
[](https://github.com/landoskape/syd/actions/workflows/tests.yml)
|
|
35
|
+
[](https://shareyourdata.readthedocs.io/en/stable/?badge=stable)
|
|
36
|
+
[](https://codecov.io/gh/landoskape/syd)
|
|
37
|
+
[](https://github.com/psf/black)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
A package to help you share your data!
|
|
41
|
+
|
|
42
|
+
Have you ever wanted to look through all your data really quickly interactively? Of course you have. Mo data mo problems, but only if you don't know what to do with it. And that's why Syd stands for show your data!
|
|
43
|
+
|
|
44
|
+
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!
|
|
45
|
+
|
|
46
|
+
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 do you know what that means? It 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!
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
It's easy, just use pip install. The dependencies are light so it should work in most environments.
|
|
50
|
+
```bash
|
|
51
|
+
pip install syd
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
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!).
|
|
56
|
+
```python
|
|
57
|
+
import matplotlib.pyplot as plt
|
|
58
|
+
import numpy as np
|
|
59
|
+
from syd import make_viewer
|
|
60
|
+
def plot(viewer, state):
|
|
61
|
+
fig, ax = plt.subplots()
|
|
62
|
+
x = np.linspace(0, 10, 1000)
|
|
63
|
+
y = state['amplitude'] * np.sin(state['frequency'] * x)
|
|
64
|
+
ax.plot(x, y)
|
|
65
|
+
return fig
|
|
66
|
+
|
|
67
|
+
viewer = make_viewer()
|
|
68
|
+
viewer.set_plot(plot)
|
|
69
|
+
viewer.add_float('amplitude', value=1.0, min=0, max=2)
|
|
70
|
+
viewer.add_float('frequency', value=1.0, min=0.1, max=5)
|
|
71
|
+
|
|
72
|
+
# env = "browser" # for viewing in a web browser
|
|
73
|
+
env = "notebook" # for viewing within a jupyter notebook
|
|
74
|
+
viewer.deploy(env=env)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
We have several examples of more complex viewers in the [examples](examples) folder. A good one to start with is the [simple example](examples/1-simple_example.ipynb) because this has detailed explanations of how to use the core elements of Syd. To see an example that showcases everything you can do with Syd, try [complex example](examples/2a-complex_example.ipynb). And to see what the same viewer looks like when written as a class, check out [subclass example](examples/2b-subclass_example.ipynb). This format is pretty useful when you want complex functionality - for example if you want to add extra supporting methods for processing data and updating parameters that require more complex logic or if your data processing requires some clever preprocessing to make plotting fast.
|
|
78
|
+
|
|
79
|
+
#### Data loading
|
|
80
|
+
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).
|
|
81
|
+
|
|
82
|
+
## Documentation
|
|
83
|
+
|
|
84
|
+
Full documentation is available at [shareyourdata.readthedocs.io](https://shareyourdata.readthedocs.io/).
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
89
|
+
|
|
90
|
+
## Contributing
|
|
91
|
+
|
|
92
|
+
Contributions are welcome! Here's how you can help:
|
|
93
|
+
|
|
94
|
+
1. Fork the repository
|
|
95
|
+
2. Create a new branch (`git checkout -b feature/amazing-feature`)
|
|
96
|
+
3. Make your changes
|
|
97
|
+
4. Run the tests (`pytest`)
|
|
98
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
99
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
100
|
+
7. Open a Pull Request online
|
|
101
|
+
|
|
102
|
+
Please make sure to update tests as appropriate and adhere to the existing coding style (black, line-length=88, other style guidelines not capture by black, generally following pep8 guidelines).
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## To-Do List
|
|
106
|
+
- Layout controls
|
|
107
|
+
- [ ] Improve the display and make it look better
|
|
108
|
+
- [ ] Add a "save" button that saves the current state of the viewer to a json file
|
|
109
|
+
- [ ] Add a "load" button that loads the viewer state from a json file
|
|
110
|
+
- [ ] Add a "freeze" button that allows the user to update state variables without updating the plot until unfreezing
|
|
111
|
+
- [ ] Add a window for capturing any error messages that might be thrown by the plot function. Maybe we could have a little interface for looking at each one (up to a point) and the user could press a button to throw an error for the traceback.
|
|
112
|
+
- [ ] Consider "app_deployed" context for each deployer...
|
|
113
|
+
- [ ] Consider the error messages and if they can be more informative and less opaque -- especially when debugging (e.g. when we always get routed to the decorators that check things...)
|
|
114
|
+
- Notebook deployment debouncer:
|
|
115
|
+
- [ ] Probably make this dependent on whether the user is in %matplotlib widget mode or not
|
|
116
|
+
- [ ] Also probably make it dependent on whether the deployer is in continuous mode or not
|
|
117
|
+
- [ ] Potentially make the wait_time dynamic depending on how fast the plot method is and how frequently the no comm messages show up... (if we can catch them)
|
|
118
|
+
- [ ] Consider adding a step to the integer parameter...
|
|
119
|
+
- Idea for figure management:
|
|
120
|
+
- [ ] We could make fig=?, ax=? arguments optional for the plot function and add a
|
|
121
|
+
"recycle_figure: bool = False" flag be part of the deploy API. This way, an
|
|
122
|
+
advanced user that wants snappy responsivity or complex figure management can
|
|
123
|
+
do so, but the default is for the user to generate a new figure object each time.
|
|
124
|
+
- Export options:
|
|
125
|
+
- [ ] 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.
|
|
126
|
+
- [ ] Export full: export the viewer in a way that contains the data to give full functionality.
|
syd-0.2.0/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Syd
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/syd)
|
|
4
|
+
[](https://github.com/landoskape/syd/actions/workflows/tests.yml)
|
|
5
|
+
[](https://shareyourdata.readthedocs.io/en/stable/?badge=stable)
|
|
6
|
+
[](https://codecov.io/gh/landoskape/syd)
|
|
7
|
+
[](https://github.com/psf/black)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
A package to help you share your data!
|
|
11
|
+
|
|
12
|
+
Have you ever wanted to look through all your data really quickly interactively? Of course you have. Mo data mo problems, but only if you don't know what to do with it. And that's why Syd stands for show your data!
|
|
13
|
+
|
|
14
|
+
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!
|
|
15
|
+
|
|
16
|
+
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 do you know what that means? It 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!
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
It's easy, just use pip install. The dependencies are light so it should work in most environments.
|
|
20
|
+
```bash
|
|
21
|
+
pip install syd
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
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!).
|
|
26
|
+
```python
|
|
27
|
+
import matplotlib.pyplot as plt
|
|
28
|
+
import numpy as np
|
|
29
|
+
from syd import make_viewer
|
|
30
|
+
def plot(viewer, state):
|
|
31
|
+
fig, ax = plt.subplots()
|
|
32
|
+
x = np.linspace(0, 10, 1000)
|
|
33
|
+
y = state['amplitude'] * np.sin(state['frequency'] * x)
|
|
34
|
+
ax.plot(x, y)
|
|
35
|
+
return fig
|
|
36
|
+
|
|
37
|
+
viewer = make_viewer()
|
|
38
|
+
viewer.set_plot(plot)
|
|
39
|
+
viewer.add_float('amplitude', value=1.0, min=0, max=2)
|
|
40
|
+
viewer.add_float('frequency', value=1.0, min=0.1, max=5)
|
|
41
|
+
|
|
42
|
+
# env = "browser" # for viewing in a web browser
|
|
43
|
+
env = "notebook" # for viewing within a jupyter notebook
|
|
44
|
+
viewer.deploy(env=env)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
We have several examples of more complex viewers in the [examples](examples) folder. A good one to start with is the [simple example](examples/1-simple_example.ipynb) because this has detailed explanations of how to use the core elements of Syd. To see an example that showcases everything you can do with Syd, try [complex example](examples/2a-complex_example.ipynb). And to see what the same viewer looks like when written as a class, check out [subclass example](examples/2b-subclass_example.ipynb). This format is pretty useful when you want complex functionality - for example if you want to add extra supporting methods for processing data and updating parameters that require more complex logic or if your data processing requires some clever preprocessing to make plotting fast.
|
|
48
|
+
|
|
49
|
+
#### Data loading
|
|
50
|
+
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).
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
Full documentation is available at [shareyourdata.readthedocs.io](https://shareyourdata.readthedocs.io/).
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
59
|
+
|
|
60
|
+
## Contributing
|
|
61
|
+
|
|
62
|
+
Contributions are welcome! Here's how you can help:
|
|
63
|
+
|
|
64
|
+
1. Fork the repository
|
|
65
|
+
2. Create a new branch (`git checkout -b feature/amazing-feature`)
|
|
66
|
+
3. Make your changes
|
|
67
|
+
4. Run the tests (`pytest`)
|
|
68
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
69
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
70
|
+
7. Open a Pull Request online
|
|
71
|
+
|
|
72
|
+
Please make sure to update tests as appropriate and adhere to the existing coding style (black, line-length=88, other style guidelines not capture by black, generally following pep8 guidelines).
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## To-Do List
|
|
76
|
+
- Layout controls
|
|
77
|
+
- [ ] Improve the display and make it look better
|
|
78
|
+
- [ ] Add a "save" button that saves the current state of the viewer to a json file
|
|
79
|
+
- [ ] Add a "load" button that loads the viewer state from a json file
|
|
80
|
+
- [ ] Add a "freeze" button that allows the user to update state variables without updating the plot until unfreezing
|
|
81
|
+
- [ ] Add a window for capturing any error messages that might be thrown by the plot function. Maybe we could have a little interface for looking at each one (up to a point) and the user could press a button to throw an error for the traceback.
|
|
82
|
+
- [ ] Consider "app_deployed" context for each deployer...
|
|
83
|
+
- [ ] Consider the error messages and if they can be more informative and less opaque -- especially when debugging (e.g. when we always get routed to the decorators that check things...)
|
|
84
|
+
- Notebook deployment debouncer:
|
|
85
|
+
- [ ] Probably make this dependent on whether the user is in %matplotlib widget mode or not
|
|
86
|
+
- [ ] Also probably make it dependent on whether the deployer is in continuous mode or not
|
|
87
|
+
- [ ] Potentially make the wait_time dynamic depending on how fast the plot method is and how frequently the no comm messages show up... (if we can catch them)
|
|
88
|
+
- [ ] Consider adding a step to the integer parameter...
|
|
89
|
+
- Idea for figure management:
|
|
90
|
+
- [ ] We could make fig=?, ax=? arguments optional for the plot function and add a
|
|
91
|
+
"recycle_figure: bool = False" flag be part of the deploy API. This way, an
|
|
92
|
+
advanced user that wants snappy responsivity or complex figure management can
|
|
93
|
+
do so, but the default is for the user to generate a new figure object each time.
|
|
94
|
+
- Export options:
|
|
95
|
+
- [ ] 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.
|
|
96
|
+
- [ ] Export full: export the viewer in a way that contains the data to give full functionality.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "syd"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
authors = [
|
|
9
9
|
{name = "Andrew Landau", email = "andrew+tyler+landau+getridofthisanddtheplusses@gmail.com"},
|
|
10
10
|
]
|
|
@@ -13,10 +13,15 @@ readme = "README.md"
|
|
|
13
13
|
requires-python = ">=3.9"
|
|
14
14
|
dependencies = [
|
|
15
15
|
"ipywidgets",
|
|
16
|
+
"ipympl",
|
|
17
|
+
"ipykernel",
|
|
16
18
|
"matplotlib",
|
|
19
|
+
"flask",
|
|
17
20
|
]
|
|
18
21
|
license = "GPL-3.0-or-later"
|
|
19
22
|
keywords = ["data-science", "machine-learning", "gui", "interactive", "jupyter", "notebook", "python"]
|
|
23
|
+
|
|
24
|
+
|
|
20
25
|
classifiers = [
|
|
21
26
|
"Development Status :: 4 - Beta",
|
|
22
27
|
"Intended Audience :: Developers",
|
|
@@ -40,11 +45,15 @@ test = [
|
|
|
40
45
|
Homepage = "https://github.com/landoskape/syd"
|
|
41
46
|
|
|
42
47
|
[tool.hatch.build]
|
|
43
|
-
include = [
|
|
44
|
-
|
|
45
|
-
]
|
|
48
|
+
include = ["syd"]
|
|
49
|
+
|
|
50
|
+
[tool.hatch.version]
|
|
51
|
+
path = "syd/__init__.py"
|
|
46
52
|
|
|
47
53
|
[tool.pytest.ini_options]
|
|
48
54
|
testpaths = ["tests"]
|
|
49
55
|
python_files = ["test_*.py"]
|
|
50
56
|
addopts = "--cov=syd --cov-report=xml --cov-report=term-missing"
|
|
57
|
+
|
|
58
|
+
[tool.black]
|
|
59
|
+
line-length = 88
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from typing import Callable, Optional
|
|
2
|
-
from .
|
|
2
|
+
from .viewer import Viewer
|
|
3
3
|
|
|
4
|
-
__version__ = "0.
|
|
4
|
+
__version__ = "0.2.0"
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def make_viewer(plot_func: Optional[Callable] = None):
|
|
8
|
-
viewer =
|
|
8
|
+
viewer = Viewer()
|
|
9
9
|
if plot_func is not None:
|
|
10
10
|
viewer.set_plot(plot_func)
|
|
11
11
|
return viewer
|