reacton 1.11.0__tar.gz → 1.11.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.
Files changed (35) hide show
  1. {reacton-1.11.0 → reacton-1.11.2}/PKG-INFO +1 -1
  2. reacton-1.11.2/reacton/_version.py +1 -0
  3. {reacton-1.11.0 → reacton-1.11.2}/reacton/core.py +10 -8
  4. {reacton-1.11.0 → reacton-1.11.2}/reacton/core_test.py +25 -0
  5. {reacton-1.11.0 → reacton-1.11.2}/reacton/utils.py +1 -1
  6. {reacton-1.11.0 → reacton-1.11.2}/reacton/utils_test.py +1 -1
  7. reacton-1.11.0/reacton/_version.py +0 -1
  8. {reacton-1.11.0 → reacton-1.11.2}/.gitignore +0 -0
  9. {reacton-1.11.0 → reacton-1.11.2}/LICENSE +0 -0
  10. {reacton-1.11.0 → reacton-1.11.2}/pyproject.toml +0 -0
  11. {reacton-1.11.0 → reacton-1.11.2}/react_ipywidgets/__init__.py +0 -0
  12. {reacton-1.11.0 → reacton-1.11.2}/react_ipywidgets/core.py +0 -0
  13. {reacton-1.11.0 → reacton-1.11.2}/reacton/__init__.py +0 -0
  14. {reacton-1.11.0 → reacton-1.11.2}/reacton/bqplot.py +0 -0
  15. {reacton-1.11.0 → reacton-1.11.2}/reacton/deprecated/__init__.py +0 -0
  16. {reacton-1.11.0 → reacton-1.11.2}/reacton/deprecated/ipyvuetify.py +0 -0
  17. {reacton-1.11.0 → reacton-1.11.2}/reacton/find.py +0 -0
  18. {reacton-1.11.0 → reacton-1.11.2}/reacton/find_test.py +0 -0
  19. {reacton-1.11.0 → reacton-1.11.2}/reacton/fuzz_test.py +0 -0
  20. {reacton-1.11.0 → reacton-1.11.2}/reacton/generate.py +0 -0
  21. {reacton-1.11.0 → reacton-1.11.2}/reacton/generate_test.py +0 -0
  22. {reacton-1.11.0 → reacton-1.11.2}/reacton/ipycanvas.py +0 -0
  23. {reacton-1.11.0 → reacton-1.11.2}/reacton/ipyvue.py +0 -0
  24. {reacton-1.11.0 → reacton-1.11.2}/reacton/ipyvue_test.py +0 -0
  25. {reacton-1.11.0 → reacton-1.11.2}/reacton/ipyvuetify.py +0 -0
  26. {reacton-1.11.0 → reacton-1.11.2}/reacton/ipywidgets.py +0 -0
  27. {reacton-1.11.0 → reacton-1.11.2}/reacton/logging.py +0 -0
  28. {reacton-1.11.0 → reacton-1.11.2}/reacton/patch.py +0 -0
  29. {reacton-1.11.0 → reacton-1.11.2}/reacton/patch_display.py +0 -0
  30. {reacton-1.11.0 → reacton-1.11.2}/reacton/py.typed +0 -0
  31. {reacton-1.11.0 → reacton-1.11.2}/reacton/rx.py +0 -0
  32. {reacton-1.11.0 → reacton-1.11.2}/reacton/test.vue +0 -0
  33. {reacton-1.11.0 → reacton-1.11.2}/reacton/test_rx.py +0 -0
  34. {reacton-1.11.0 → reacton-1.11.2}/reacton/threads_test.py +0 -0
  35. {reacton-1.11.0 → reacton-1.11.2}/reacton/work.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: reacton
3
- Version: 1.11.0
3
+ Version: 1.11.2
4
4
  Dynamic: Summary
5
5
  Project-URL: Home, https://www.github.com/widgetti/reacton
6
6
  Project-URL: Documentation, https://reacton.solara.dev
@@ -0,0 +1 @@
1
+ __version__ = "1.11.2"
@@ -517,14 +517,10 @@ class Element(Generic[W]):
517
517
  try:
518
518
  try:
519
519
  widget = self.component.widget(**kwargs)
520
- hold_trait_notifications = widget.hold_trait_notifications
521
-
522
- @contextlib.contextmanager
523
- def hold_trait_notifications_extra(*args, **kwargs):
524
- with rc, hold_trait_notifications(*args, **kwargs):
525
- yield
526
-
527
- widget.hold_trait_notifications = hold_trait_notifications_extra
520
+ # A partial of one module-level context manager, not a @contextlib.contextmanager defined here:
521
+ # that decorator runs functools.wraps for every widget, and on free-threaded Python setting
522
+ # attributes on a function object stops all threads.
523
+ widget.hold_trait_notifications = functools.partial(_hold_trait_notifications_extra, rc, widget.hold_trait_notifications)
528
524
 
529
525
  if self._meta:
530
526
  widget._react_meta = dict(self._meta)
@@ -3423,3 +3419,9 @@ _default_container: Optional[Callable[..., Element]] = Fragment
3423
3419
  # not a public api yet, used in solara for now only.
3424
3420
  # lifecycle of context objects are linked to the lifecycle of the component
3425
3421
  _component_context_manager_classes: List[Any] = []
3422
+
3423
+
3424
+ @contextlib.contextmanager
3425
+ def _hold_trait_notifications_extra(rc, hold_trait_notifications, *args, **kwargs):
3426
+ with rc, hold_trait_notifications(*args, **kwargs):
3427
+ yield
@@ -4437,3 +4437,28 @@ def test_close_after_a_failed_render_of_a_deep_tree_is_fast():
4437
4437
  with pytest.raises(ValueError):
4438
4438
  rc.close() # close() raises the error of the failed render again
4439
4439
  assert time.monotonic() - start < 2
4440
+
4441
+
4442
+ def test_create_widget_does_not_wrap_a_function_per_widget():
4443
+ # on free-threaded Python, functools.wraps (setting attributes on a function) stops all threads,
4444
+ # so creating a widget should not define and wrap a new function
4445
+ import functools
4446
+
4447
+ @react.component
4448
+ def Test():
4449
+ with w.VBox() as main:
4450
+ for i in range(10):
4451
+ w.IntSlider(value=i)
4452
+ return main
4453
+
4454
+ with unittest.mock.patch("functools.update_wrapper", wraps=functools.update_wrapper) as update_wrapper:
4455
+ box, rc = react.render(Test(), handle_error=False)
4456
+ assert update_wrapper.call_count == 0
4457
+ slider = rc.find(widgets.IntSlider).widgets[0]
4458
+ changes = []
4459
+ slider.observe(lambda change: changes.append(change["new"]), "value")
4460
+ with slider.hold_trait_notifications():
4461
+ slider.value = 42
4462
+ assert changes == []
4463
+ assert changes == [42]
4464
+ rc.close()
@@ -19,7 +19,7 @@ def without_default(func: Callable, kwargs):
19
19
  return non_default_kwargs
20
20
 
21
21
 
22
- def implements(f: Callable[P, T]):
22
+ def implements(f: Callable[P, T]) -> Callable[[Callable], Callable[P, T]]:
23
23
  def caster(fimpl: Callable) -> Callable[P, T]:
24
24
  # wraps gives us the right signature at runtime (such as Jupyter)
25
25
  return cast(Callable[P, T], functools.wraps(f)(fimpl))
@@ -118,7 +118,7 @@ def test_equals():
118
118
  def on_click():
119
119
  pass
120
120
 
121
- return w.Button(on_click=on_click, label=f"{a}")
121
+ return w.Button(on_click=on_click, description=f"{a}")
122
122
 
123
123
  el1 = make_el(1)
124
124
  el2 = make_el(1)
@@ -1 +0,0 @@
1
- __version__ = "1.11.0"
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
File without changes
File without changes
File without changes
File without changes
File without changes