syd 0.1.2__py3-none-any.whl → 0.1.4__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.2"
1
+ __version__ = "0.1.4"
syd/interactive_viewer.py CHANGED
@@ -76,7 +76,7 @@ class InteractiveViewer:
76
76
  self.state = {}
77
77
  self._app_deployed = False
78
78
 
79
- def param_dict(self) -> Dict[str, Any]:
79
+ def get_state(self) -> Dict[str, Any]:
80
80
  return {name: param.value for name, param in self.parameters.items()}
81
81
 
82
82
  def plot(self, **kwargs) -> Figure:
@@ -94,8 +94,9 @@ class InteractiveViewer:
94
94
  def perform_callbacks(self, name: str) -> bool:
95
95
  """Perform callbacks for all parameters that have changed"""
96
96
  if name in self.callbacks:
97
+ state = self.get_state()
97
98
  for callback in self.callbacks[name]:
98
- callback(self.parameters[name].value)
99
+ callback(state)
99
100
 
100
101
  def on_change(self, parameter_name: str, callback: Callable):
101
102
  """Register a function to be called when a parameter changes."""
syd/notebook_deploy.py CHANGED
@@ -97,13 +97,13 @@ class NotebookDeployment:
97
97
  def _create_integer_pair_widget(self, param: IntegerPairParameter) -> widgets.HBox:
98
98
  """Create a pair of integer input widgets."""
99
99
  low = widgets.IntText(
100
- value=param.default_low if param.default_low is not None else param.min_value,
100
+ value=param.default[0],
101
101
  description=f"{param.name} (low)",
102
102
  layout=widgets.Layout(width="47%"),
103
103
  style={"description_width": "initial"},
104
104
  )
105
105
  high = widgets.IntText(
106
- value=param.default_high if param.default_high is not None else param.max_value,
106
+ value=param.default[1],
107
107
  description=f"{param.name} (high)",
108
108
  layout=widgets.Layout(width="47%"),
109
109
  style={"description_width": "initial"},
@@ -113,13 +113,13 @@ class NotebookDeployment:
113
113
  def _create_float_pair_widget(self, param: FloatPairParameter) -> widgets.HBox:
114
114
  """Create a pair of float input widgets."""
115
115
  low = widgets.FloatText(
116
- value=param.default_low if param.default_low is not None else param.min_value,
116
+ value=param.default[0],
117
117
  description=f"{param.name} (low)",
118
118
  layout=widgets.Layout(width="47%"),
119
119
  style={"description_width": "initial"},
120
120
  )
121
121
  high = widgets.FloatText(
122
- value=param.default_high if param.default_high is not None else param.max_value,
122
+ value=param.default[1],
123
123
  description=f"{param.name} (high)",
124
124
  layout=widgets.Layout(width="47%"),
125
125
  style={"description_width": "initial"},
@@ -220,7 +220,7 @@ class NotebookDeployment:
220
220
  """Update the plot with current parameters and size."""
221
221
  self._current_fig.clear()
222
222
  self._current_fig.set_size_inches(self.fig_width, self.fig_height)
223
- self._current_fig = self.viewer.plot(fig=self._current_fig, state=self.viewer.param_dict())
223
+ self._current_fig = self.viewer.plot(fig=self._current_fig, state=self.viewer.get_state())
224
224
 
225
225
  # Apply tight layout to remove dead space
226
226
  self._current_fig.tight_layout()
@@ -266,7 +266,7 @@ class NotebookDeployment:
266
266
  # Create initial plot
267
267
  self._current_fig = plt.figure(figsize=(self.fig_width, self.fig_height))
268
268
  plt.close(self._current_fig) # close the figure to prevent it from being displayed
269
- self._current_fig = self.viewer.plot(fig=self._current_fig, state=self.viewer.param_dict())
269
+ self._current_fig = self.viewer.plot(fig=self._current_fig, state=self.viewer.get_state())
270
270
  with self.plot_output:
271
271
  display(self._current_fig)
272
272
 
syd/parameters.py CHANGED
@@ -182,7 +182,7 @@ class PairParameter(Parameter[Tuple[T, T]], ABC):
182
182
  raise NotImplementedError("Need to define in subclass for proper IDE support")
183
183
 
184
184
  @abstractmethod
185
- def _validate_value(self, value: Any) -> T:
185
+ def _validate(self, value: Any) -> T:
186
186
  raise NotImplementedError
187
187
 
188
188
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syd
3
- Version: 0.1.2
3
+ Version: 0.1.4
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>
@@ -0,0 +1,8 @@
1
+ syd/__init__.py,sha256=Wzf5T3NBDfhQoTnhnRNHSlAsE0XMqbclXG-M81Vas70,22
2
+ syd/interactive_viewer.py,sha256=33aFY6Q4vg6fP5QVs2RYqfnqmFJzML-Lcnhbb1XwN2g,9353
3
+ syd/notebook_deploy.py,sha256=k7yq7Noq30IlCbMXZ1rrX8oW5a3nxLNJHDFGvoJMYxg,11472
4
+ syd/parameters.py,sha256=oQSAGM2D2Db4YLzj_nQb6_vPp18ltld7qvFC138lRJw,9885
5
+ syd-0.1.4.dist-info/METADATA,sha256=re0-a0zHTlvEMyJIAHf7AM-OVEQkohwes7K2-xWfy_0,2449
6
+ syd-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ syd-0.1.4.dist-info/licenses/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
8
+ syd-0.1.4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- syd/__init__.py,sha256=YvuYzWnKtqBb-IqG8HAu-nhIYAsgj9Vmc_b9o7vO-js,22
2
- syd/interactive_viewer.py,sha256=TASk0_uE5HyPd7vhD29ioeXQiSANr-sB_TYh-w-eK-c,9339
3
- syd/notebook_deploy.py,sha256=Sc11UdSQIeYqcqJFt1aPX7NVbmeQ2nmQUB3_CfnrWLo,11698
4
- syd/parameters.py,sha256=QMcT4PVSDr6WB4M-f9dbVa1B63RCuPlbMQI0E_JvmKs,9891
5
- syd-0.1.2.dist-info/METADATA,sha256=HjzUImQmRUehpI2xT9iX6QiqYuJS5_zvHu7gzVaclDg,2449
6
- syd-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- syd-0.1.2.dist-info/licenses/LICENSE,sha256=YF6QR6Vjxcg5b_sYIyqkME7FZYau5TfEUGTG-0JeRK0,35129
8
- syd-0.1.2.dist-info/RECORD,,
File without changes