pulse-framework 0.1.38a7__py3-none-any.whl → 0.1.38a8__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.
pulse/cli/cmd.py CHANGED
@@ -249,7 +249,15 @@ def generate(
249
249
  app = app_ctx.app
250
250
  console.log(f"📋 Found {len(app.routes.flat_tree)} routes")
251
251
 
252
- addr = app.server_address or "localhost:8000"
252
+ # In CI or prod mode, server_address must be provided
253
+ if (ci or prod) and not app.server_address:
254
+ typer.echo(
255
+ "❌ server_address must be provided when generating in CI or production mode. "
256
+ + "Set it in your App constructor or via the PULSE_SERVER_ADDRESS environment variable."
257
+ )
258
+ raise typer.Exit(1)
259
+
260
+ addr = app.server_address or "http://localhost:8000"
253
261
  app.run_codegen(addr)
254
262
 
255
263
  if len(app.routes.flat_tree) > 0:
pulse/state.py CHANGED
@@ -206,6 +206,15 @@ class State(ABC, metaclass=StateMeta):
206
206
  ```
207
207
 
208
208
  Properties will automatically trigger re-renders when changed.
209
+
210
+ Override `on_dispose()` to run cleanup code when the state is disposed:
211
+ ```python
212
+ class MyState(ps.State):
213
+ def on_dispose(self):
214
+ # Clean up timers, connections, etc.
215
+ self.timer.cancel()
216
+ self.connection.close()
217
+ ```
209
218
  """
210
219
 
211
220
  @override
@@ -310,7 +319,19 @@ class State(ABC, metaclass=StateMeta):
310
319
  # if isinstance(value,QueryProperty):
311
320
  # value.
312
321
 
322
+ def on_dispose(self) -> None:
323
+ """
324
+ Override this method to run cleanup code when the state is disposed.
325
+
326
+ This is called automatically when `dispose()` is called, before effects are disposed.
327
+ Use this to clean up timers, connections, or other resources.
328
+ """
329
+ pass
330
+
313
331
  def dispose(self):
332
+ # Call user-defined cleanup hook first
333
+ self.on_dispose()
334
+
314
335
  disposed = set()
315
336
  for value in self.__dict__.values():
316
337
  if isinstance(value, Effect):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pulse-framework
3
- Version: 0.1.38a7
3
+ Version: 0.1.38a8
4
4
  Summary: Pulse - Full-stack framework for building real-time React applications in Python
5
5
  Requires-Dist: websockets>=12.0
6
6
  Requires-Dist: fastapi>=0.104.0
@@ -2,7 +2,7 @@ pulse/__init__.py,sha256=P2CLvFxP8IPiUsy3Z-hZD-1tbsvhd4eVlMNYg5WOPjE,31709
2
2
  pulse/app.py,sha256=a-fHuX1MfA0Whjyy8l2JxroRkJd5VG0Aba31xfKcuFY,29871
3
3
  pulse/channel.py,sha256=DuD1mg_xWvkpAWSKZ-EtBYdUzJ8IuKH0fxdgGOvFXpg,13041
4
4
  pulse/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- pulse/cli/cmd.py,sha256=PpThGpbvDNn9c9I2sPK8O-XMU1P0eHDoIODed9Q8rQg,13548
5
+ pulse/cli/cmd.py,sha256=AakXuTLEQEb3GP-WLzZUoVLpxoszGzU3OfdhhC-RGR0,13872
6
6
  pulse/cli/dependencies.py,sha256=ZBqBAfMvMBQUvh4THdPDztTMQ_dyR52S1IuotP_eEZs,5623
7
7
  pulse/cli/folder_lock.py,sha256=kvUmZBg869lwCTIZFoge9dhorv8qPXHTWwVv_jQg1k8,3477
8
8
  pulse/cli/helpers.py,sha256=8bRlV3d7w3w-jHaFvFYt9Pzue6_CbKOq_Z3jBsBOeUk,8820
@@ -59,13 +59,13 @@ pulse/renderer.py,sha256=dJiX9VeHr9kC1UBw5oaKB8Mv-3OCMGTrHiKgLJ5FL50,16759
59
59
  pulse/request.py,sha256=sPsSRWi5KvReSPBLIs_kzqomn1wlRk1BTLZ5s0chQr4,4979
60
60
  pulse/routing.py,sha256=o3xmWpoMgJMkI1W7nFJpDkCT30ejTG2MnCV42OwgLaI,12492
61
61
  pulse/serializer.py,sha256=8RAITNoSNm5-U38elHpWmkBpcM_rxZFMCluJSfldfk4,5420
62
- pulse/state.py,sha256=nbnN9wGrHTP0AOFBfb4zKNzYaSkmLR5u0t4TVHg-UDA,9972
62
+ pulse/state.py,sha256=y9Z-KBYQVd63fb1wF8gQ4KilK7c2ElYLf6U-miWteM8,10560
63
63
  pulse/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  pulse/types/event_handler.py,sha256=OF7sOgYBb6iUs59RH1vQIH7aOrGPfs3nAaF7how-4PQ,1658
65
65
  pulse/user_session.py,sha256=kCZtQpYZe2keDXzusd6jsjjw075am0dXrb25jKLg5JU,7578
66
66
  pulse/vdom.py,sha256=KTNBh2dVvDy9eXRzhneBJgk7F35MyWec8R_puQ4tSRY,12420
67
67
  pulse/version.py,sha256=711vaM1jVIQPgkisGgKZqwmw019qZIsc_QTae75K2pg,1895
68
- pulse_framework-0.1.38a7.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
69
- pulse_framework-0.1.38a7.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
70
- pulse_framework-0.1.38a7.dist-info/METADATA,sha256=fxno0AsA_hH9_w_nI7Vd5dQemHgDn6rxyNKaFdfW5fQ,582
71
- pulse_framework-0.1.38a7.dist-info/RECORD,,
68
+ pulse_framework-0.1.38a8.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
69
+ pulse_framework-0.1.38a8.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
70
+ pulse_framework-0.1.38a8.dist-info/METADATA,sha256=0nWfbIPndCGbuGRobas4TI8SFjylLcbn6YahOUnztw8,582
71
+ pulse_framework-0.1.38a8.dist-info/RECORD,,