hmr 0.5.2.1__py3-none-any.whl → 0.5.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hmr
3
- Version: 0.5.2.1
3
+ Version: 0.5.2.2
4
4
  Summary: Hot Module Reload for Python
5
5
  Project-URL: repository, https://github.com/promplate/pyth-on-line/tree/reactivity
6
6
  Requires-Python: >=3.12
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
11
11
 
12
12
  # HMR for Python
13
13
 
14
- <sup> on-demand · fine-grained · pull-push reactivity </sup>
14
+ <sup> on-demand · fine-grained · push-pull reactivity </sup>
15
15
 
16
16
  [![PyPI - Version](https://img.shields.io/pypi/v/hmr)](https://pypi.org/project/hmr/)
17
17
  [![Supported Python Version](https://img.shields.io/python/required-version-toml?tomlFilePath=https://github.com/promplate/pyth-on-line/raw/refs/heads/reactivity/packages/hmr/pyproject.toml)](https://github.com/promplate/pyth-on-line/blob/reactivity/packages/hmr/pyproject.toml)
@@ -1,14 +1,14 @@
1
- hmr-0.5.2.1.dist-info/METADATA,sha256=A-0hVQkuyKNRaNS-opfmUwmULQY6_SZHYxIHn2RMVQE,2001
2
- hmr-0.5.2.1.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- hmr-0.5.2.1.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
1
+ hmr-0.5.2.2.dist-info/METADATA,sha256=oweBlpOxlLru70fMiG1JKAx6aS-B1-e8Xx4qATH2EwI,2001
2
+ hmr-0.5.2.2.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ hmr-0.5.2.2.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
4
4
  reactivity/__init__.py,sha256=pX-RUzkezCC1x4eOWGxNhXbwrbvBLP_3pQuZr9eZz1Y,300
5
5
  reactivity/functional.py,sha256=jJLEq88w5ag2cXuD1T118uEjnEg37_mqvWmFkb47KVY,1300
6
6
  reactivity/helpers.py,sha256=rcrCXy1mmlei-if_BN4nSgS2IG9kBj-jq1YRwEfcITo,5329
7
7
  reactivity/hmr/__init__.py,sha256=S5ZIHqCRpevdzWuhS0aCua_S8F0LkK0YNg6IgeTScFQ,177
8
8
  reactivity/hmr/__main__.py,sha256=uIcyjR5gMFIXH_3hS0B3SD00RirVf7GIct-uItx675o,64
9
9
  reactivity/hmr/api.py,sha256=sKDQV7uKRVoDifTZKrLQGZP-fzgYbdVjfEOC6ki4NKY,2280
10
- reactivity/hmr/core.py,sha256=LpIZubK8XZLAxVM3ZWcxPT14WjcbZVHiU57AMN_KF8Y,11688
10
+ reactivity/hmr/core.py,sha256=U6aq96IP1Ox1B486F_HdI9qYUF6q2bC5rsH6xpdafhw,11693
11
11
  reactivity/hmr/hooks.py,sha256=jIFpe4CNxfaS9RcR4OIodx_sOZlnJ_IA1T1RtHPXhwU,945
12
12
  reactivity/hmr/utils.py,sha256=h9m7iRXlvsLTrHoXV9gEVbhz3XsPK4KgnStYoCAWE5I,1616
13
- reactivity/primitives.py,sha256=QkiUF8bqLZtyXguWwNJi34HJIc-SzUKqi1M9UgTNuvI,5952
14
- hmr-0.5.2.1.dist-info/RECORD,,
13
+ reactivity/primitives.py,sha256=Cq1tBNmVFCjnCq30TCku-l1JimlC5fJh9Z2GHcfWNUY,6483
14
+ hmr-0.5.2.2.dist-info/RECORD,,
reactivity/hmr/core.py CHANGED
@@ -79,7 +79,7 @@ class ReactiveModule(ModuleType):
79
79
  self.__namespace_proxy = NamespaceProxy(namespace, self)
80
80
  self.__file = file
81
81
 
82
- self.instances[file.resolve()] = self
82
+ __class__.instances[file.resolve()] = self
83
83
 
84
84
  @property
85
85
  def file(self):
@@ -341,4 +341,4 @@ def cli():
341
341
  reloader.keep_watching_until_interrupt()
342
342
 
343
343
 
344
- __version__ = "0.5.2.1"
344
+ __version__ = "0.5.2.2"
reactivity/primitives.py CHANGED
@@ -3,6 +3,22 @@ from typing import Any, Self, overload
3
3
  from weakref import WeakKeyDictionary, WeakSet
4
4
 
5
5
 
6
+ def _equal(a, b):
7
+ if a is b:
8
+ return True
9
+ comparison_result = a == b
10
+ for _ in range(3): # pandas DataFrame's .all() returns a Series, which is still incompatible :(
11
+ try:
12
+ if comparison_result:
13
+ return True
14
+ except ValueError as e:
15
+ if ".all()" in str(e) and hasattr(comparison_result, "all"): # array-like instances
16
+ comparison_result = comparison_result.all()
17
+ else:
18
+ return False
19
+ return False
20
+
21
+
6
22
  class Subscribable:
7
23
  def __init__(self):
8
24
  super().__init__()
@@ -69,7 +85,7 @@ class Signal[T](Subscribable):
69
85
  return self._value
70
86
 
71
87
  def set(self, value: T):
72
- if not self._check_equality or self._value != value:
88
+ if not self._check_equality or not _equal(self._value, value):
73
89
  self._value = value
74
90
  self.notify()
75
91
  return True
@@ -186,7 +202,7 @@ class Derived[T](BaseDerived[T]):
186
202
  value = self.fn()
187
203
  self.dirty = False
188
204
  if self._check_equality:
189
- if value == self._value:
205
+ if _equal(value, self._value):
190
206
  return
191
207
  elif self._value is self.UNSET: # do not notify on first set
192
208
  self._value = value
File without changes