diff --git a/CHANGELOG.md b/CHANGELOG.md index c97dd55..61c5ca8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## v0.2.1 + +Updated to support numpy 2.0 + +## v0.2.0 + +Full-fledged implementation. + ## v0.1.0 First official release. diff --git a/Pipfile b/Pipfile index 6cd7876..f5f128c 100644 --- a/Pipfile +++ b/Pipfile @@ -20,7 +20,7 @@ jupyterlab-widgets = "==3.0.13" kiwisolver = "==1.4.7" matplotlib = "==3.9.4" matplotlib-inline = "==0.1.7" -numpy = "==1.26.4" +numpy = "==2.3.5" packaging = "==24.2" parso = "==0.8.4" pexpect = "==4.9.0" diff --git a/pyproject.toml b/pyproject.toml index 6901d76..9ba76e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ ] dependencies = [ "ipywidgets>=8.0.0", - "numpy<2.0.0", + "numpy<3.0", "widget_code_input>=4.0.17", "matplotlib", "termcolor" diff --git a/src/scwidgets/__init__.py b/src/scwidgets/__init__.py index f37f659..9003ca3 100644 --- a/src/scwidgets/__init__.py +++ b/src/scwidgets/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.2.0" +__version__ = "0.2.1" __authors__ = "the scicode-widgets developer team" from .check import * # noqa: F403 diff --git a/src/scwidgets/check/_asserts.py b/src/scwidgets/check/_asserts.py index b42c164..3cbc97c 100644 --- a/src/scwidgets/check/_asserts.py +++ b/src/scwidgets/check/_asserts.py @@ -307,5 +307,5 @@ def assert_numpy_sub_dtype( assert_numpy_floating_sub_dtype = functools.partial( - assert_numpy_sub_dtype, numpy_type=np.floating + assert_numpy_sub_dtype, numpy_type=float ) diff --git a/src/scwidgets/check/_widget_check_registry.py b/src/scwidgets/check/_widget_check_registry.py index 9294e03..b46ab1d 100644 --- a/src/scwidgets/check/_widget_check_registry.py +++ b/src/scwidgets/check/_widget_check_registry.py @@ -26,7 +26,7 @@ class CheckableWidget: """ def __init__( - self, check_registry: Optional[CheckRegistry], name: Optional[str] = None + self, check_registry: Optional[CheckRegistry] = None, name: Optional[str] = None ): self._check_registry = check_registry if self._check_registry is not None: diff --git a/src/scwidgets/cue/_widget_cue.py b/src/scwidgets/cue/_widget_cue.py index 11f7ab8..4830ec1 100644 --- a/src/scwidgets/cue/_widget_cue.py +++ b/src/scwidgets/cue/_widget_cue.py @@ -20,7 +20,7 @@ class CueWidget: def __init__( self, - widgets_to_observe: Union[List[Widget], Widget], + widgets_to_observe: Union[List[Widget], Widget, None] = None, traits_to_observe: Union[ str, Sentinel, List[Union[str, Sentinel, List[str]]] ] = "value", @@ -30,7 +30,9 @@ def __init__( ): self._widgets_to_observe: List[Widget] = [] self._traits_to_observe: List[Union[str, Sentinel, List[str]]] = [] - self.set_widgets_to_observe(widgets_to_observe, traits_to_observe) + if widgets_to_observe is not None: + # normal usage (your explicit calls) + self.set_widgets_to_observe(widgets_to_observe, traits_to_observe) self.cued = cued diff --git a/src/scwidgets/cue/_widget_reset_cue_button.py b/src/scwidgets/cue/_widget_reset_cue_button.py index 8e9d669..e95f722 100644 --- a/src/scwidgets/cue/_widget_reset_cue_button.py +++ b/src/scwidgets/cue/_widget_reset_cue_button.py @@ -75,7 +75,8 @@ def __init__( self._css_style = css_style - Button.__init__(self, *args, **kwargs) + tooltip = kwargs.pop("button_tooltip", None) + Button.__init__(self, *args, tooltip=tooltip, **kwargs) if widgets_to_observe is None: widgets_to_observe = [] @@ -88,7 +89,12 @@ def __init__( if cued is None: cued = any([cue_widget.cued for cue_widget in cue_widgets]) - CueWidget.__init__(self, widgets_to_observe, traits_to_observe, cued) + CueWidget.__init__( + self, + widgets_to_observe=widgets_to_observe, + traits_to_observe=traits_to_observe, + cued=cued, + ) self._cue_widgets = cue_widgets self.on_click(self._on_click) diff --git a/tests/test_widgets.py b/tests/test_widgets.py index 9e918b4..6227270 100644 --- a/tests/test_widgets.py +++ b/tests/test_widgets.py @@ -819,7 +819,7 @@ def test_reset_cue_button( # Check if unused text input does not effect cueing of button unused_text_input.send_keys("a") - time.sleep(0.1) + time.sleep(0.5) assert unused_text_input.get_attribute("value") == "Unuseda" assert ( sum( @@ -847,7 +847,7 @@ def test_reset_cue_button( ) assert not (reset_cue_button.is_enabled()) else: - time.sleep(0.1) + time.sleep(0.5) assert reset_cue_button.is_enabled() # Checks if two more widgets are cued on change @@ -884,7 +884,7 @@ def test_reset_cue_button( ) assert not (reset_cue_button.is_enabled()) else: - time.sleep(0.1) + time.sleep(0.5) assert reset_cue_button.is_enabled() assert ( @@ -993,7 +993,7 @@ def test_button_clicks( # button is obscured so we need to click with action on the cell ActionChains(driver).click(nb_cell).perform() check_all_widgets_button.click() - time.sleep(0.1) + time.sleep(0.5) outputs = nb_cell.find_elements(By.CLASS_NAME, OUTPUT_CLASS_NAME) assert ( sum( @@ -1011,7 +1011,7 @@ def test_button_clicks( WebDriverWait(driver, 5).until( expected_conditions.element_to_be_clickable(set_all_references_button) ).click() - time.sleep(0.1) + time.sleep(0.5) outputs = nb_cell.find_elements(By.CLASS_NAME, OUTPUT_CLASS_NAME) assert ( sum( @@ -1029,7 +1029,7 @@ def test_button_clicks( WebDriverWait(driver, 5).until( expected_conditions.element_to_be_clickable(check_all_widgets_button) ).click() - time.sleep(0.1) + time.sleep(0.5) outputs = nb_cell.find_elements(By.CLASS_NAME, OUTPUT_CLASS_NAME) assert ( sum( diff --git a/tox.ini b/tox.ini index 656a3f5..6996e28 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ setenv = deps = pytest<8.0.0 pytest-rerunfailures - pytest-html<4.0.0, + pytest-html<4.0.0 # selenium juypter notebook tests jupyterlab==3.6.5 # fixing selenium version to have backwards-compatibility with pytest-selenium @@ -41,8 +41,8 @@ deps = jupytext==1.15.0 imageio # we fix matplotlib for consistent image tests - matplotlib==3.7.2 - numpy<2.0.0 + matplotlib==3.7.3 + numpy<3.0 scikit-image ipympl commands = @@ -74,8 +74,8 @@ deps = jupytext==1.15.0 imageio # we fix matplotlib for consistent image tests - matplotlib==3.7.2 - numpy<2.0.0 + matplotlib==3.7.3 + numpy<3.0 scikit-image ipympl commands =