hmr 0.4.0.3__tar.gz → 0.4.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hmr
3
- Version: 0.4.0.3
3
+ Version: 0.4.0.4
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
@@ -6,7 +6,7 @@ description = "Hot Module Reload for Python"
6
6
  dependencies = [
7
7
  "watchfiles>=0.21,<2 ; sys_platform != 'emscripten'",
8
8
  ]
9
- version = "0.4.0.3"
9
+ version = "0.4.0.4"
10
10
 
11
11
  [project.scripts]
12
12
  hmr = "reactivity.hmr:cli"
@@ -1,14 +1,15 @@
1
- from .core import AsyncReloader, BaseReloader, SyncReloader
1
+ from .core import AsyncReloader, BaseReloader, SyncReloader, create_effect
2
2
  from .hooks import call_post_reload_hooks, call_pre_reload_hooks
3
3
 
4
4
 
5
5
  class LifecycleMixin(BaseReloader):
6
6
  def run_with_hooks(self):
7
7
  call_pre_reload_hooks()
8
- self.run_entry_file()
8
+ self.effect = create_effect(self.run_entry_file)
9
9
  call_post_reload_hooks()
10
10
 
11
11
  def clean_up(self):
12
+ self.effect.dispose()
12
13
  self.entry_module.load.dispose()
13
14
  self.entry_module.load.invalidate()
14
15
 
@@ -122,7 +122,8 @@ class ReactiveModule(ModuleType):
122
122
  try:
123
123
  return self.__namespace_proxy[name]
124
124
  except KeyError as e:
125
- if getattr := self.__namespace_proxy.get("__getattr__"):
125
+ caller = currentframe().f_back.f_globals["__name__"] # type: ignore
126
+ if caller != "importlib._bootstrap" and (getattr := self.__namespace_proxy.get("__getattr__")):
126
127
  return getattr(name)
127
128
  raise AttributeError(*e.args) from e
128
129
 
@@ -339,4 +340,4 @@ def cli():
339
340
  SyncReloader(entry).keep_watching_until_interrupt()
340
341
 
341
342
 
342
- __version__ = "0.4.0.3"
343
+ __version__ = "0.4.0.4"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes