hmr 0.4.0__py3-none-any.whl → 0.4.0.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.
- {hmr-0.4.0.dist-info → hmr-0.4.0.2.dist-info}/METADATA +1 -1
- {hmr-0.4.0.dist-info → hmr-0.4.0.2.dist-info}/RECORD +6 -6
- reactivity/hmr/api.py +14 -6
- reactivity/hmr/core.py +3 -1
- {hmr-0.4.0.dist-info → hmr-0.4.0.2.dist-info}/WHEEL +0 -0
- {hmr-0.4.0.dist-info → hmr-0.4.0.2.dist-info}/entry_points.txt +0 -0
@@ -1,14 +1,14 @@
|
|
1
|
-
hmr-0.4.0.dist-info/METADATA,sha256=
|
2
|
-
hmr-0.4.0.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
-
hmr-0.4.0.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
1
|
+
hmr-0.4.0.2.dist-info/METADATA,sha256=AxILguedqE7qPqsaQD9u0SJ4Zap0mNDOvOZoSS7ikVg,260
|
2
|
+
hmr-0.4.0.2.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
hmr-0.4.0.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=U06vshcVhZ0sb218gcmHtEhfgTNAGtQ7zyvPz2w5qKM,1292
|
6
6
|
reactivity/helpers.py,sha256=1KCpre2HTFZrngEKkI2HwSFMkCmsUCq2aPEbp0y3kKg,5140
|
7
7
|
reactivity/hmr/__init__.py,sha256=S5ZIHqCRpevdzWuhS0aCua_S8F0LkK0YNg6IgeTScFQ,177
|
8
8
|
reactivity/hmr/__main__.py,sha256=uIcyjR5gMFIXH_3hS0B3SD00RirVf7GIct-uItx675o,64
|
9
|
-
reactivity/hmr/api.py,sha256=
|
10
|
-
reactivity/hmr/core.py,sha256=
|
9
|
+
reactivity/hmr/api.py,sha256=7GA-m25PofzvMigH-9JE4GTOC2Y5eLgvUeIgGUg0UcU,1845
|
10
|
+
reactivity/hmr/core.py,sha256=AZ4ssyz5PUKP7h1c0fI3lYFdTOlFVz9sVOYvx3V420w,11559
|
11
11
|
reactivity/hmr/hooks.py,sha256=-yLr5ktiyqPb1nDbHsgv6-c_ZkziBjNqCU-0PCfXGYU,592
|
12
12
|
reactivity/hmr/utils.py,sha256=-PO-LMP4sc3IP-Bn_baq2w9IFWBZ3zGesgRn5wR6bS0,1555
|
13
13
|
reactivity/primitives.py,sha256=mB6cbHKDqtilOfgaEhshtRWJq9s0nPEKqRK0hfCoyFE,5671
|
14
|
-
hmr-0.4.0.dist-info/RECORD,,
|
14
|
+
hmr-0.4.0.2.dist-info/RECORD,,
|
reactivity/hmr/api.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from .core import AsyncReloader, BaseReloader, SyncReloader
|
2
|
+
from .hooks import call_post_reload_hooks, call_pre_reload_hooks
|
2
3
|
|
3
4
|
|
4
5
|
def _clean_up(r: BaseReloader):
|
@@ -6,11 +7,18 @@ def _clean_up(r: BaseReloader):
|
|
6
7
|
r.entry_module.load.invalidate()
|
7
8
|
|
8
9
|
|
9
|
-
class
|
10
|
+
class ReloadHooksMixin(BaseReloader):
|
11
|
+
def run_with_hooks(self):
|
12
|
+
call_pre_reload_hooks()
|
13
|
+
self.run_entry_file()
|
14
|
+
call_post_reload_hooks()
|
15
|
+
|
16
|
+
|
17
|
+
class SyncReloaderAPI(SyncReloader, ReloadHooksMixin):
|
10
18
|
def __enter__(self):
|
11
19
|
from threading import Thread
|
12
20
|
|
13
|
-
self.
|
21
|
+
self.run_with_hooks()
|
14
22
|
self.thread = Thread(target=self.start_watching)
|
15
23
|
self.thread.start()
|
16
24
|
return super()
|
@@ -23,7 +31,7 @@ class SyncReloaderAPI(SyncReloader):
|
|
23
31
|
async def __aenter__(self):
|
24
32
|
from asyncio import ensure_future, to_thread
|
25
33
|
|
26
|
-
await to_thread(self.
|
34
|
+
await to_thread(self.run_with_hooks)
|
27
35
|
self.future = ensure_future(to_thread(self.start_watching))
|
28
36
|
return super()
|
29
37
|
|
@@ -33,12 +41,12 @@ class SyncReloaderAPI(SyncReloader):
|
|
33
41
|
_clean_up(self)
|
34
42
|
|
35
43
|
|
36
|
-
class AsyncReloaderAPI(AsyncReloader):
|
44
|
+
class AsyncReloaderAPI(AsyncReloader, ReloadHooksMixin):
|
37
45
|
def __enter__(self):
|
38
46
|
from asyncio import run
|
39
47
|
from threading import Thread
|
40
48
|
|
41
|
-
self.
|
49
|
+
self.run_with_hooks()
|
42
50
|
self.thread = Thread(target=lambda: run(self.start_watching()))
|
43
51
|
self.thread.start()
|
44
52
|
return super()
|
@@ -51,7 +59,7 @@ class AsyncReloaderAPI(AsyncReloader):
|
|
51
59
|
async def __aenter__(self):
|
52
60
|
from asyncio import ensure_future, to_thread
|
53
61
|
|
54
|
-
await to_thread(self.
|
62
|
+
await to_thread(self.run_with_hooks)
|
55
63
|
self.future = ensure_future(self.start_watching())
|
56
64
|
return super()
|
57
65
|
|
reactivity/hmr/core.py
CHANGED
@@ -322,7 +322,9 @@ class AsyncReloader(BaseReloader):
|
|
322
322
|
del self._stop_event
|
323
323
|
|
324
324
|
async def keep_watching_until_interrupt(self):
|
325
|
+
call_pre_reload_hooks()
|
325
326
|
with suppress(KeyboardInterrupt), create_effect(self.run_entry_file):
|
327
|
+
call_post_reload_hooks()
|
326
328
|
await self.start_watching()
|
327
329
|
|
328
330
|
|
@@ -337,4 +339,4 @@ def cli():
|
|
337
339
|
SyncReloader(entry).keep_watching_until_interrupt()
|
338
340
|
|
339
341
|
|
340
|
-
__version__ = "0.4.0"
|
342
|
+
__version__ = "0.4.0.2"
|
File without changes
|
File without changes
|