syd 0.1.6__py3-none-any.whl → 0.2.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.
- syd/__init__.py +3 -3
- syd/flask_deployment/__init__.py +7 -0
- syd/flask_deployment/deployer.py +594 -291
- syd/flask_deployment/static/__init__.py +1 -0
- syd/flask_deployment/static/css/styles.css +226 -19
- syd/flask_deployment/static/js/viewer.js +744 -0
- syd/flask_deployment/templates/__init__.py +1 -0
- syd/flask_deployment/templates/index.html +34 -0
- syd/flask_deployment/testing_principles.md +300 -0
- syd/notebook_deployment/__init__.py +1 -1
- syd/notebook_deployment/deployer.py +139 -53
- syd/notebook_deployment/widgets.py +214 -123
- syd/parameters.py +295 -393
- syd/support.py +168 -0
- syd/{interactive_viewer.py → viewer.py} +393 -470
- syd-0.2.0.dist-info/METADATA +126 -0
- syd-0.2.0.dist-info/RECORD +19 -0
- syd/flask_deployment/components.py +0 -497
- syd/flask_deployment/static/js/components.js +0 -51
- syd/flask_deployment/templates/base.html +0 -26
- syd/flask_deployment/templates/viewer.html +0 -97
- syd-0.1.6.dist-info/METADATA +0 -106
- syd-0.1.6.dist-info/RECORD +0 -18
- {syd-0.1.6.dist-info → syd-0.2.0.dist-info}/WHEEL +0 -0
- {syd-0.1.6.dist-info → syd-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
function updateParameter(name, value) {
|
|
2
|
-
console.log(`Sending parameter update: ${name} = ${value}`); // Debug log
|
|
3
|
-
fetch('/update_parameter', {
|
|
4
|
-
method: 'POST',
|
|
5
|
-
headers: {
|
|
6
|
-
'Content-Type': 'application/json',
|
|
7
|
-
},
|
|
8
|
-
body: JSON.stringify({name, value})
|
|
9
|
-
})
|
|
10
|
-
.then(response => response.json())
|
|
11
|
-
.then(data => {
|
|
12
|
-
if (data.error) {
|
|
13
|
-
console.error(`Error updating parameter: ${data.error}`); // Debug log
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
console.log('Update successful, applying updates'); // Debug log
|
|
17
|
-
// Update plot
|
|
18
|
-
document.getElementById('plot').src = data.plot;
|
|
19
|
-
// Apply any parameter updates
|
|
20
|
-
for (const [param, js] of Object.entries(data.updates)) {
|
|
21
|
-
console.log(`Applying update for ${param}`); // Debug log
|
|
22
|
-
eval(js);
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
.catch(error => {
|
|
26
|
-
console.error('Error in updateParameter:', error); // Debug log
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function buttonClick(name) {
|
|
31
|
-
fetch('/button_click', {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
headers: {
|
|
34
|
-
'Content-Type': 'application/json',
|
|
35
|
-
},
|
|
36
|
-
body: JSON.stringify({name})
|
|
37
|
-
})
|
|
38
|
-
.then(response => response.json())
|
|
39
|
-
.then(data => {
|
|
40
|
-
if (data.error) {
|
|
41
|
-
console.error(data.error);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
// Update plot
|
|
45
|
-
document.getElementById('plot').src = data.plot;
|
|
46
|
-
// Apply any parameter updates
|
|
47
|
-
for (const [param, js] of Object.entries(data.updates)) {
|
|
48
|
-
eval(js);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>{% block title %}Interactive Viewer{% endblock %}</title>
|
|
5
|
-
{% for css in required_css %}
|
|
6
|
-
<link rel="stylesheet" href="{{ css }}">
|
|
7
|
-
{% endfor %}
|
|
8
|
-
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
|
|
9
|
-
<style>
|
|
10
|
-
:root {
|
|
11
|
-
--controls-width: {{ config.controls_width_percent }}%;
|
|
12
|
-
--plot-width: {{ 100 - config.controls_width_percent }}%;
|
|
13
|
-
}
|
|
14
|
-
{{ custom_styles | safe }}
|
|
15
|
-
</style>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
{% block content %}{% endblock %}
|
|
19
|
-
|
|
20
|
-
{% for js in required_js %}
|
|
21
|
-
<script src="{{ js }}"></script>
|
|
22
|
-
{% endfor %}
|
|
23
|
-
<script src="{{ url_for('static', filename='js/components.js') }}"></script>
|
|
24
|
-
{% block scripts %}{% endblock %}
|
|
25
|
-
</body>
|
|
26
|
-
</html>
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# templates/viewer.html
|
|
2
|
-
<!DOCTYPE html>
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>Interactive Viewer</title>
|
|
6
|
-
{% for css in required_css %}
|
|
7
|
-
<link rel="stylesheet" href="{{ css }}">
|
|
8
|
-
{% endfor %}
|
|
9
|
-
<style>
|
|
10
|
-
{{ custom_styles | safe }}
|
|
11
|
-
.controls {
|
|
12
|
-
{% if config.is_horizontal %}
|
|
13
|
-
width: {{ config.controls_width_percent }}%;
|
|
14
|
-
float: left;
|
|
15
|
-
padding-right: 20px;
|
|
16
|
-
{% endif %}
|
|
17
|
-
}
|
|
18
|
-
.plot-container {
|
|
19
|
-
{% if config.is_horizontal %}
|
|
20
|
-
width: {{ 100 - config.controls_width_percent }}%;
|
|
21
|
-
float: left;
|
|
22
|
-
{% endif %}
|
|
23
|
-
}
|
|
24
|
-
#plot {
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: auto;
|
|
27
|
-
}
|
|
28
|
-
</style>
|
|
29
|
-
</head>
|
|
30
|
-
<body>
|
|
31
|
-
<div class="container-fluid">
|
|
32
|
-
<div class="row">
|
|
33
|
-
<div class="controls">
|
|
34
|
-
{{ components_html | safe }}
|
|
35
|
-
</div>
|
|
36
|
-
<div class="plot-container">
|
|
37
|
-
<img id="plot" src="{{ initial_plot }}">
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
{% for js in required_js %}
|
|
43
|
-
<script src="{{ js }}"></script>
|
|
44
|
-
{% endfor %}
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
function updateParameter(name, value) {
|
|
48
|
-
fetch('/update_parameter', {
|
|
49
|
-
method: 'POST',
|
|
50
|
-
headers: {
|
|
51
|
-
'Content-Type': 'application/json',
|
|
52
|
-
},
|
|
53
|
-
body: JSON.stringify({name, value})
|
|
54
|
-
})
|
|
55
|
-
.then(response => response.json())
|
|
56
|
-
.then(data => {
|
|
57
|
-
if (data.error) {
|
|
58
|
-
console.error(data.error);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
// Update plot
|
|
62
|
-
document.getElementById('plot').src = data.plot;
|
|
63
|
-
// Apply any parameter updates
|
|
64
|
-
for (const [param, js] of Object.entries(data.updates)) {
|
|
65
|
-
eval(js);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function buttonClick(name) {
|
|
71
|
-
fetch('/button_click', {
|
|
72
|
-
method: 'POST',
|
|
73
|
-
headers: {
|
|
74
|
-
'Content-Type': 'application/json',
|
|
75
|
-
},
|
|
76
|
-
body: JSON.stringify({name})
|
|
77
|
-
})
|
|
78
|
-
.then(response => response.json())
|
|
79
|
-
.then(data => {
|
|
80
|
-
if (data.error) {
|
|
81
|
-
console.error(data.error);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
// Update plot
|
|
85
|
-
document.getElementById('plot').src = data.plot;
|
|
86
|
-
// Apply any parameter updates
|
|
87
|
-
for (const [param, js] of Object.entries(data.updates)) {
|
|
88
|
-
eval(js);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Initialize components
|
|
94
|
-
{{ components_init | safe }}
|
|
95
|
-
</script>
|
|
96
|
-
</body>
|
|
97
|
-
</html>
|
syd-0.1.6.dist-info/METADATA
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: syd
|
|
3
|
-
Version: 0.1.6
|
|
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: ipywidgets
|
|
22
|
-
Requires-Dist: matplotlib
|
|
23
|
-
Provides-Extra: test
|
|
24
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
25
|
-
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
|
|
28
|
-
# syd
|
|
29
|
-
|
|
30
|
-
[](https://badge.fury.io/py/syd)
|
|
31
|
-
[](https://github.com/landoskape/syd/actions/workflows/tests.yml)
|
|
32
|
-
[](https://shareyourdata.readthedocs.io/en/stable/?badge=stable)
|
|
33
|
-
[](https://codecov.io/gh/landoskape/syd)
|
|
34
|
-
[](https://github.com/psf/black)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
A package to help you share your data!
|
|
38
|
-
|
|
39
|
-
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 starts with looking at your data. And that's why syd stands for show your data!
|
|
40
|
-
|
|
41
|
-
Syd is a system for creating a data viewing GUI that you can view on a web-browser. And guess what? Since it opens on a web browser, you can even open it on any other computer on your local network! For example, your PI. 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!
|
|
42
|
-
|
|
43
|
-
Okay, so what is it? Syd is an automated system to convert some basic python plotting code into an interactive GUI. This is great, because it means you only have to think about what you want to plot and what you want to be interactive, syd does the work to make an interface. There's some small overhead for learning how to prepare your data to work with syd, but we provide some templates to make it easy. You know what that means? That means you get to focus on _thinking_ about your data, rather than spending time writing code to look at it. And that's why syd stands for Science, Yes! Datum!
|
|
44
|
-
|
|
45
|
-
## Installation
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
pip install syd
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Quick Start
|
|
52
|
-
Right now the only way to use it is in a jupyter notebook. More deployments coming soon!
|
|
53
|
-
This is an example of a sine wave viewer which is about as simple as it gets.
|
|
54
|
-
```python
|
|
55
|
-
# In a notebook!
|
|
56
|
-
import matplotlib.pyplot as plt
|
|
57
|
-
import numpy as np
|
|
58
|
-
from syd import make_viewer
|
|
59
|
-
def plot(viewer, state):
|
|
60
|
-
fig, ax = plt.subplots()
|
|
61
|
-
x = np.linspace(0, 10, 1000)
|
|
62
|
-
y = state['amplitude'] * np.sin(state['frequency'] * x)
|
|
63
|
-
ax.plot(x, y)
|
|
64
|
-
return fig
|
|
65
|
-
|
|
66
|
-
viewer = make_viewer()
|
|
67
|
-
viewer.set_plot(plot)
|
|
68
|
-
viewer.add_float('amplitude', value=1.0, min_value=0, max_value=2)
|
|
69
|
-
viewer.add_float('frequency', value=1.0, min_value=0.1, max_value=5)
|
|
70
|
-
viewer.deploy(continuous=True)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
We have several examples of more complex viewers in the [examples](examples) folder. A good one
|
|
74
|
-
to start with is the [first example](examples/first_example.ipynb) because this has detailed
|
|
75
|
-
explanations of how to use the core elements of SYD. To see what the exact same viewer looks like
|
|
76
|
-
when written as a class, see the [subclass example](examples/subclass_example.ipynb). This format
|
|
77
|
-
is pretty useful when you want complex functionality - for example if you want to add extra
|
|
78
|
-
supporting methods for processing data and updating parameters that require more complex logic.
|
|
79
|
-
|
|
80
|
-
## Documentation
|
|
81
|
-
|
|
82
|
-
Full documentation is available at [shareyourdata.readthedocs.io](https://shareyourdata.readthedocs.io/).
|
|
83
|
-
|
|
84
|
-
Key features:
|
|
85
|
-
- Create interactive matplotlib visualizations with minimal code
|
|
86
|
-
- Support for various parameter types (sliders, dropdowns, checkboxes, etc.)
|
|
87
|
-
- Real-time updates as parameters change
|
|
88
|
-
- Works in Jupyter notebooks and can be shared over local network
|
|
89
|
-
|
|
90
|
-
## License
|
|
91
|
-
|
|
92
|
-
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
93
|
-
|
|
94
|
-
## Contributing
|
|
95
|
-
|
|
96
|
-
Contributions are welcome! Here's how you can help:
|
|
97
|
-
|
|
98
|
-
1. Fork the repository
|
|
99
|
-
2. Create a new branch (`git checkout -b feature/amazing-feature`)
|
|
100
|
-
3. Make your changes
|
|
101
|
-
4. Run the tests (`pytest`)
|
|
102
|
-
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
103
|
-
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
104
|
-
7. Open a Pull Request online
|
|
105
|
-
|
|
106
|
-
Please make sure to update tests as appropriate and adhere to the existing coding style.
|
syd-0.1.6.dist-info/RECORD
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
syd/__init__.py,sha256=elTyYXUlIX5Vv8AFjhM5C_XeZtU83YeGq_W980duI6k,284
|
|
2
|
-
syd/interactive_viewer.py,sha256=2vEyRwq4dxzGbJOz3UymNw_RJXRHrzv7UbJ2CV6q1bI,53950
|
|
3
|
-
syd/parameters.py,sha256=DbjevWsbIoVqlS3bYkqRd6SXJ054iexoNFj4VBss2eA,47703
|
|
4
|
-
syd/flask_deployment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
syd/flask_deployment/components.py,sha256=I5xTFX5ho6EZ8ZjxknlluzSsxP5atUBAi_k7b8p_9Os,17391
|
|
6
|
-
syd/flask_deployment/deployer.py,sha256=EOo-oT3duBwWxVpQdpe-pXmAGGzfnqk4EY-vNcN-vAI,11288
|
|
7
|
-
syd/flask_deployment/static/css/styles.css,sha256=0zBjzquFMcxTNYNmVP1KdS3_7c1WiMYEqYHvubUyRhU,514
|
|
8
|
-
syd/flask_deployment/static/js/components.js,sha256=o_Ty-fvFsXTSl0eavJDDqhhxi-N3nuB-IPXkmin4vvI,1563
|
|
9
|
-
syd/flask_deployment/static/js/viewer.js,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
syd/flask_deployment/templates/base.html,sha256=6WZ9-Pc6pAysQbBSg_rihfRXPHMwyFxVR8YYD5bL524,783
|
|
11
|
-
syd/flask_deployment/templates/viewer.html,sha256=AoCdWQ5TIUEnpi6fjWdWUO9XJSLGFH0fHggGZd87yeg,2813
|
|
12
|
-
syd/notebook_deployment/__init__.py,sha256=eRum4_pXLTtaoUWvVnVCxJFrLM8Nn8EQ0yLwE9puh-w,41
|
|
13
|
-
syd/notebook_deployment/deployer.py,sha256=7iQ5kzs2VIkItmHbPpxtWdSRkGth5OABqyATc5WtbgI,8739
|
|
14
|
-
syd/notebook_deployment/widgets.py,sha256=bBBBJtgzfYcoXdhkuF4Du7HNXwwPjj_shGDhy3VoWs8,17446
|
|
15
|
-
syd-0.1.6.dist-info/METADATA,sha256=N7-fVmqKWzwJhhgl6t-Gft9BAlnhUpcTG9eni1Zs9Dk,5412
|
|
16
|
-
syd-0.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
17
|
-
syd-0.1.6.dist-info/licenses/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
|
|
18
|
-
syd-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|