pulse-framework 0.1.38a3__py3-none-any.whl → 0.1.38a5__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
@@ -139,37 +139,54 @@ def run(
139
139
  web_root if web_root.exists() else app_ctx.app_file
140
140
  )
141
141
 
142
- if not server_only:
143
- # Skip dependency checking and installation in production/CI mode (assumes pre-built)
144
- if env.pulse_env == "dev":
142
+ if env.pulse_env == "dev" and not server_only:
143
+ try:
144
+ to_add = check_web_dependencies(
145
+ web_root,
146
+ pulse_version=PULSE_PY_VERSION,
147
+ )
148
+ except DependencyResolutionError as exc:
149
+ console.log(f"❌ {exc}")
150
+ raise typer.Exit(1) from None
151
+ except DependencyError as exc:
152
+ console.log(f"❌ {exc}")
153
+ raise typer.Exit(1) from None
154
+
155
+ if to_add:
145
156
  try:
146
- to_add = check_web_dependencies(
157
+ dep_plan = prepare_web_dependencies(
147
158
  web_root,
148
159
  pulse_version=PULSE_PY_VERSION,
149
160
  )
150
- except DependencyResolutionError as exc:
151
- console.log(f"❌ {exc}")
152
- raise typer.Exit(1) from None
153
- except DependencyError as exc:
154
- console.log(f"❌ {exc}")
161
+ if dep_plan:
162
+ _run_dependency_plan(console, web_root, dep_plan)
163
+ except subprocess.CalledProcessError:
164
+ console.log("❌ Failed to install web dependencies with Bun.")
155
165
  raise typer.Exit(1) from None
156
166
 
157
- if to_add:
158
- try:
159
- dep_plan = prepare_web_dependencies(
160
- web_root,
161
- pulse_version=PULSE_PY_VERSION,
162
- )
163
- if dep_plan:
164
- _run_dependency_plan(console, web_root, dep_plan)
165
- except subprocess.CalledProcessError:
166
- console.log("❌ Failed to install web dependencies with Bun.")
167
- raise typer.Exit(1) from None
168
-
169
167
  server_args = extra_flags if not web_only else []
170
168
  web_args = extra_flags if web_only else []
171
169
 
172
170
  commands: list[CommandSpec] = []
171
+ # Build web command first (when needed) so we can set PULSE_REACT_SERVER_ADDRESS
172
+ # before building the uvicorn command, which needs that env var
173
+ if not server_only:
174
+ if is_single_server:
175
+ web_port = find_available_port(5173)
176
+ commands.append(
177
+ build_web_command(
178
+ web_root=web_root,
179
+ extra_args=web_args,
180
+ port=web_port,
181
+ mode=app_instance.env,
182
+ )
183
+ )
184
+ # Set env var so app can read the React server address
185
+ react_server_address = f"http://localhost:{web_port}"
186
+ os.environ[ENV_PULSE_REACT_SERVER_ADDRESS] = react_server_address
187
+ else:
188
+ commands.append(build_web_command(web_root=web_root, extra_args=web_args))
189
+
173
190
  if not web_only:
174
191
  commands.append(
175
192
  build_uvicorn_command(
@@ -187,23 +204,6 @@ def run(
187
204
  )
188
205
  )
189
206
 
190
- # In single-server mode, start web server separately (not managed by app lifecycle)
191
- if is_single_server and not server_only:
192
- web_port = find_available_port(5173)
193
- commands.append(
194
- build_web_command(
195
- web_root=web_root,
196
- extra_args=web_args,
197
- port=web_port,
198
- mode=app_instance.env,
199
- )
200
- )
201
- # Set env var so app can read the React server address
202
- react_server_address = f"http://localhost:{web_port}"
203
- os.environ[ENV_PULSE_REACT_SERVER_ADDRESS] = react_server_address
204
- elif not is_single_server and not server_only:
205
- commands.append(build_web_command(web_root=web_root, extra_args=web_args))
206
-
207
207
  tag_colors = {"server": "cyan", "web": "orange1"}
208
208
 
209
209
  with FolderLock(web_root):
@@ -416,18 +416,25 @@ def build_web_command(
416
416
  port: int | None = None,
417
417
  mode: PulseEnv = "dev",
418
418
  ) -> CommandSpec:
419
+ command_env = os.environ.copy()
419
420
  if mode == "prod":
420
421
  # Production: use built server
421
422
  args = ["bun", "run", "start"]
422
423
  else:
423
424
  # Development: use dev server
424
425
  args = ["bun", "run", "dev"]
426
+
425
427
  if port is not None:
426
- args.extend(["--port", str(port)])
428
+ if mode == "prod":
429
+ # react-router-serve uses PORT environment variable
430
+ # Don't add --port flag for production
431
+ command_env["PORT"] = str(port)
432
+ else:
433
+ # react-router dev accepts --port flag
434
+ args.extend(["--port", str(port)])
427
435
  if extra_args:
428
436
  args.extend(extra_args)
429
437
 
430
- command_env = os.environ.copy()
431
438
  command_env.update(
432
439
  {
433
440
  "FORCE_COLOR": "1",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pulse-framework
3
- Version: 0.1.38a3
3
+ Version: 0.1.38a5
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=aJg4LvIeLYalXvEe1u47_A9ktS3HGIf4ZeAo6w1tbMQ,31463
2
2
  pulse/app.py,sha256=iBdqEt1SFD_28rDVAaZsaSixu4uhyRUAnwKTjGSEy0c,26906
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=bkWxrQy9DmB8l8gok_9l9ofbj0zu5_PC3Ny-K5fuKrM,13418
5
+ pulse/cli/cmd.py,sha256=PpThGpbvDNn9c9I2sPK8O-XMU1P0eHDoIODed9Q8rQg,13548
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
@@ -65,7 +65,7 @@ pulse/types/event_handler.py,sha256=OF7sOgYBb6iUs59RH1vQIH7aOrGPfs3nAaF7how-4PQ,
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.38a3.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
69
- pulse_framework-0.1.38a3.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
70
- pulse_framework-0.1.38a3.dist-info/METADATA,sha256=ox_UWflZQSQ2pOHJkuzdArLYIDvtkKPUNNCky7A_syU,582
71
- pulse_framework-0.1.38a3.dist-info/RECORD,,
68
+ pulse_framework-0.1.38a5.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
69
+ pulse_framework-0.1.38a5.dist-info/entry_points.txt,sha256=i7aohd3QaPu5IcuGKKvsQQEiMYMe5HcF56QEsaLVO64,46
70
+ pulse_framework-0.1.38a5.dist-info/METADATA,sha256=FwPAxE5j13EoVmk-DjlAdblENYSL2dRq_DpV2kwTRwY,582
71
+ pulse_framework-0.1.38a5.dist-info/RECORD,,