param 2.4.2rc1__tar.gz → 2.5.0a0__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 (75) hide show
  1. {param-2.4.2rc1 → param-2.5.0a0}/PKG-INFO +2 -1
  2. {param-2.4.2rc1 → param-2.5.0a0}/param/__init__.py +2 -1
  3. {param-2.4.2rc1 → param-2.5.0a0}/param/_utils.py +55 -4
  4. {param-2.4.2rc1 → param-2.5.0a0}/param/_version.py +2 -2
  5. {param-2.4.2rc1 → param-2.5.0a0}/param/parameters.py +4 -1
  6. {param-2.4.2rc1 → param-2.5.0a0}/param/reactive.py +321 -21
  7. {param-2.4.2rc1 → param-2.5.0a0}/pyproject.toml +1 -0
  8. {param-2.4.2rc1 → param-2.5.0a0}/tests/testreactive.py +767 -0
  9. {param-2.4.2rc1 → param-2.5.0a0}/tests/testutils.py +51 -0
  10. {param-2.4.2rc1 → param-2.5.0a0}/.gitignore +0 -0
  11. {param-2.4.2rc1 → param-2.5.0a0}/LICENSE.txt +0 -0
  12. {param-2.4.2rc1 → param-2.5.0a0}/README.md +0 -0
  13. {param-2.4.2rc1 → param-2.5.0a0}/numbergen/__init__.py +0 -0
  14. {param-2.4.2rc1 → param-2.5.0a0}/param/depends.py +0 -0
  15. {param-2.4.2rc1 → param-2.5.0a0}/param/display.py +0 -0
  16. {param-2.4.2rc1 → param-2.5.0a0}/param/ipython.py +0 -0
  17. {param-2.4.2rc1 → param-2.5.0a0}/param/mypy_plugin.py +0 -0
  18. {param-2.4.2rc1 → param-2.5.0a0}/param/parameterized.py +0 -0
  19. {param-2.4.2rc1 → param-2.5.0a0}/param/py.typed +0 -0
  20. {param-2.4.2rc1 → param-2.5.0a0}/param/serializer.py +0 -0
  21. {param-2.4.2rc1 → param-2.5.0a0}/param/version.py +0 -0
  22. {param-2.4.2rc1 → param-2.5.0a0}/tests/__init__.py +0 -0
  23. {param-2.4.2rc1 → param-2.5.0a0}/tests/assert_types.py +0 -0
  24. {param-2.4.2rc1 → param-2.5.0a0}/tests/conftest.py +0 -0
  25. {param-2.4.2rc1 → param-2.5.0a0}/tests/pyrightconfig-bare.json +0 -0
  26. {param-2.4.2rc1 → param-2.5.0a0}/tests/testaddparameter.py +0 -0
  27. {param-2.4.2rc1 → param-2.5.0a0}/tests/testbind.py +0 -0
  28. {param-2.4.2rc1 → param-2.5.0a0}/tests/testbooleanparam.py +0 -0
  29. {param-2.4.2rc1 → param-2.5.0a0}/tests/testbytesparam.py +0 -0
  30. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcalendardateparam.py +0 -0
  31. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcalendardaterangeparam.py +0 -0
  32. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcallable.py +0 -0
  33. {param-2.4.2rc1 → param-2.5.0a0}/tests/testclassselector.py +0 -0
  34. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcolorparameter.py +0 -0
  35. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcomparator.py +0 -0
  36. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcompositeparams.py +0 -0
  37. {param-2.4.2rc1 → param-2.5.0a0}/tests/testcustomparam.py +0 -0
  38. {param-2.4.2rc1 → param-2.5.0a0}/tests/testdateparam.py +0 -0
  39. {param-2.4.2rc1 → param-2.5.0a0}/tests/testdaterangeparam.py +0 -0
  40. {param-2.4.2rc1 → param-2.5.0a0}/tests/testdefaultfactory.py +0 -0
  41. {param-2.4.2rc1 → param-2.5.0a0}/tests/testdefaults.py +0 -0
  42. {param-2.4.2rc1 → param-2.5.0a0}/tests/testdeprecations.py +0 -0
  43. {param-2.4.2rc1 → param-2.5.0a0}/tests/testdynamicparams.py +0 -0
  44. {param-2.4.2rc1 → param-2.5.0a0}/tests/testfiledeserialization.py +0 -0
  45. {param-2.4.2rc1 → param-2.5.0a0}/tests/testfileselector.py +0 -0
  46. {param-2.4.2rc1 → param-2.5.0a0}/tests/testimports.py +0 -0
  47. {param-2.4.2rc1 → param-2.5.0a0}/tests/testipythonmagic.py +0 -0
  48. {param-2.4.2rc1 → param-2.5.0a0}/tests/testjsonserialization.py +0 -0
  49. {param-2.4.2rc1 → param-2.5.0a0}/tests/testlist.py +0 -0
  50. {param-2.4.2rc1 → param-2.5.0a0}/tests/testlistselector.py +0 -0
  51. {param-2.4.2rc1 → param-2.5.0a0}/tests/testmultifileselector.py +0 -0
  52. {param-2.4.2rc1 → param-2.5.0a0}/tests/testnumbergen.py +0 -0
  53. {param-2.4.2rc1 → param-2.5.0a0}/tests/testnumberparameter.py +0 -0
  54. {param-2.4.2rc1 → param-2.5.0a0}/tests/testnumpy.py +0 -0
  55. {param-2.4.2rc1 → param-2.5.0a0}/tests/testobjectselector.py +0 -0
  56. {param-2.4.2rc1 → param-2.5.0a0}/tests/testpandas.py +0 -0
  57. {param-2.4.2rc1 → param-2.5.0a0}/tests/testparamdepends.py +0 -0
  58. {param-2.4.2rc1 → param-2.5.0a0}/tests/testparameter.py +0 -0
  59. {param-2.4.2rc1 → param-2.5.0a0}/tests/testparameterizedobject.py +0 -0
  60. {param-2.4.2rc1 → param-2.5.0a0}/tests/testparameterizedrepr.py +0 -0
  61. {param-2.4.2rc1 → param-2.5.0a0}/tests/testparamoutput.py +0 -0
  62. {param-2.4.2rc1 → param-2.5.0a0}/tests/testparamunion.py +0 -0
  63. {param-2.4.2rc1 → param-2.5.0a0}/tests/testpathparam.py +0 -0
  64. {param-2.4.2rc1 → param-2.5.0a0}/tests/testpickle.py +0 -0
  65. {param-2.4.2rc1 → param-2.5.0a0}/tests/testrangeparameter.py +0 -0
  66. {param-2.4.2rc1 → param-2.5.0a0}/tests/testrefs.py +0 -0
  67. {param-2.4.2rc1 → param-2.5.0a0}/tests/testreprhtml.py +0 -0
  68. {param-2.4.2rc1 → param-2.5.0a0}/tests/testselector.py +0 -0
  69. {param-2.4.2rc1 → param-2.5.0a0}/tests/testsignatures.py +0 -0
  70. {param-2.4.2rc1 → param-2.5.0a0}/tests/teststringparam.py +0 -0
  71. {param-2.4.2rc1 → param-2.5.0a0}/tests/testtimedependent.py +0 -0
  72. {param-2.4.2rc1 → param-2.5.0a0}/tests/testtupleparam.py +0 -0
  73. {param-2.4.2rc1 → param-2.5.0a0}/tests/testversion.py +0 -0
  74. {param-2.4.2rc1 → param-2.5.0a0}/tests/testwatch.py +0 -0
  75. {param-2.4.2rc1 → param-2.5.0a0}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: param
3
- Version: 2.4.2rc1
3
+ Version: 2.5.0a0
4
4
  Summary: Declarative parameters for robust Python classes and a rich API for reactive programming
5
5
  Project-URL: Homepage, https://param.holoviz.org/
6
6
  Project-URL: Tracker, https://github.com/holoviz/param/issues
@@ -23,6 +23,7 @@ Classifier: Programming Language :: Python :: 3.11
23
23
  Classifier: Programming Language :: Python :: 3.12
24
24
  Classifier: Programming Language :: Python :: 3.13
25
25
  Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Programming Language :: Python :: 3.15
26
27
  Classifier: Topic :: Scientific/Engineering
27
28
  Classifier: Topic :: Software Development :: Libraries
28
29
  Classifier: Typing :: Typed
@@ -99,7 +99,7 @@ from .parameters import (
99
99
  CalendarDateRange,
100
100
  Event,
101
101
  )
102
- from .reactive import bind, rx
102
+ from .reactive import ReactiveError, bind, rx
103
103
  from ._utils import (
104
104
  descendents,
105
105
  concrete_descendents,
@@ -171,6 +171,7 @@ __all__ = (
171
171
  'Dict',
172
172
  'Dynamic',
173
173
  'ERROR',
174
+ 'ReactiveError',
174
175
  'Event',
175
176
  'FileSelector',
176
177
  'Filename',
@@ -12,7 +12,7 @@ import warnings
12
12
  from collections import OrderedDict, abc, defaultdict
13
13
  from contextlib import contextmanager
14
14
  from textwrap import dedent
15
- from threading import get_ident
15
+ from threading import get_ident, local
16
16
 
17
17
  if t.TYPE_CHECKING:
18
18
  import asyncio
@@ -608,18 +608,69 @@ def _in_ipython():
608
608
 
609
609
  _running_tasks: set[asyncio.Task] = set()
610
610
 
611
+ _thread_state = local()
612
+
613
+ def _fallback_event_loop() -> asyncio.AbstractEventLoop:
614
+ """
615
+ Return the event loop to drive coroutines on when nothing else is running.
616
+
617
+ The loop is cached per thread and reused, since creating one per call leaks
618
+ the file descriptors each loop holds. It is kept thread-local because
619
+ ``run_until_complete`` may not be driven from two threads at once.
620
+ """
621
+ import asyncio
622
+ event_loop = getattr(_thread_state, 'event_loop', None)
623
+ if event_loop is None or event_loop.is_closed():
624
+ event_loop = asyncio.new_event_loop()
625
+ _thread_state.event_loop = event_loop
626
+ return event_loop
627
+
628
+ def _drain_fallback_loop(event_loop: asyncio.AbstractEventLoop) -> None:
629
+ """
630
+ Finish off anything left running on the fallback loop.
631
+
632
+ A coroutine driven by :func:`async_executor` may schedule further work
633
+ before it completes, which ``run_until_complete`` leaves pending. Since the
634
+ loop is reused, such a leftover would otherwise resume in the middle of an
635
+ unrelated drive, so it is cancelled and given the chance to clean up here.
636
+ """
637
+ import asyncio
638
+ pending = [task for task in asyncio.all_tasks(event_loop) if not task.done()]
639
+ if not pending:
640
+ return
641
+ for task in pending:
642
+ task.cancel()
643
+ event_loop.run_until_complete(asyncio.gather(*pending, return_exceptions=True))
644
+
611
645
  def async_executor(func):
646
+ """
647
+ Schedule the awaitable returned by ``func`` on the running event loop.
648
+
649
+ Without a running loop the awaitable is instead driven to completion on a
650
+ loop of param's own, i.e. the call blocks the caller until the coroutine
651
+ has finished. Applications that can offer a loop (such as Panel) are
652
+ expected to override ``param.parameterized.async_executor``.
653
+ """
612
654
  import asyncio
613
655
  try:
614
656
  event_loop = asyncio.get_running_loop()
615
657
  except RuntimeError:
616
- event_loop = asyncio.new_event_loop()
617
- if event_loop.is_running():
658
+ event_loop = None
659
+ if event_loop is not None:
618
660
  task = asyncio.ensure_future(func())
619
661
  _running_tasks.add(task)
620
662
  task.add_done_callback(_running_tasks.discard)
621
- else:
663
+ return
664
+ event_loop = _fallback_event_loop()
665
+ try:
622
666
  event_loop.run_until_complete(func())
667
+ except asyncio.CancelledError:
668
+ # A coroutine superseded while it was being driven synchronously must
669
+ # not surface the cancellation in the caller, which is generally an
670
+ # unrelated attribute access or parameter update.
671
+ pass
672
+ finally:
673
+ _drain_fallback_loop(event_loop)
623
674
 
624
675
  @t.runtime_checkable
625
676
  class _HasTypes(t.Protocol):
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '2.4.2rc1'
22
- __version_tuple__ = version_tuple = (2, 4, 2, 'rc1')
21
+ __version__ = version = '2.5.0a0'
22
+ __version_tuple__ = version_tuple = (2, 5, 0, 'a0')
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -2647,7 +2647,10 @@ class Selector(SelectorBase, _SignatureSelector[_T]):
2647
2647
  object.__setattr__(self, 'check_on_set', check_on_set)
2648
2648
 
2649
2649
  instantiate = params.pop("instantiate", Undefined)
2650
- params["instantiate"] = False if instantiate is Undefined else instantiate # pyrefly: ignore[bad-assignment]
2650
+ if isinstance(instantiate, bool):
2651
+ params["instantiate"] = instantiate
2652
+ else:
2653
+ params["instantiate"] = False
2651
2654
  super().__init__(default=default, **params)
2652
2655
  # Required as Parameter sets allow_None=True if default is None
2653
2656
  if allow_None is Undefined: