fastled 1.4.32__py3-none-any.whl → 1.4.33__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.
fastled/__version__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # IMPORTANT! There's a bug in github which will REJECT any version update
2
2
  # that has any other change in the repo. Please bump the version as the
3
3
  # ONLY change in a commit, or else the pypi update and the release will fail.
4
- __version__ = "1.4.32"
4
+ __version__ = "1.4.33"
5
5
 
6
6
  __version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
fastled/client_server.py CHANGED
@@ -122,14 +122,59 @@ def _run_web_compiler(
122
122
  (output_dir / "index.html").write_text(error_html, encoding="utf-8")
123
123
  return web_result
124
124
 
125
+ # Extract zip contents to fastled_js directory
126
+ extraction_start_time = time.time()
127
+ output_dir.mkdir(exist_ok=True)
128
+ with tempfile.TemporaryDirectory() as temp_dir:
129
+ temp_path = Path(temp_dir)
130
+ temp_zip = temp_path / "result.zip"
131
+ temp_zip.write_bytes(web_result.zip_bytes)
132
+
133
+ # Clear existing contents
134
+ shutil.rmtree(output_dir, ignore_errors=True)
135
+ output_dir.mkdir(exist_ok=True)
136
+
137
+ # Extract zip contents
138
+ shutil.unpack_archive(temp_zip, output_dir, "zip")
139
+ extraction_time = time.time() - extraction_start_time
140
+
125
141
  def print_results() -> None:
126
142
  hash_value = (
127
143
  web_result.hash_value
128
144
  if web_result.hash_value is not None
129
145
  else "NO HASH VALUE"
130
146
  )
147
+
148
+ # Build timing breakdown
149
+ timing_breakdown = f" Time: {diff:.2f} (seconds)"
150
+ if hasattr(web_result, "zip_time"):
151
+ timing_breakdown += f"\n zip creation: {web_result.zip_time:.2f}"
152
+ if web_result.libfastled_time > 0:
153
+ timing_breakdown += (
154
+ f"\n libfastled: {web_result.libfastled_time:.2f}"
155
+ )
156
+ timing_breakdown += (
157
+ f"\n sketch compile + link: {web_result.sketch_time:.2f}"
158
+ )
159
+ if hasattr(web_result, "response_processing_time"):
160
+ timing_breakdown += f"\n response processing: {web_result.response_processing_time:.2f}"
161
+
162
+ # Calculate any unaccounted time
163
+ accounted_time = (
164
+ web_result.zip_time
165
+ + web_result.libfastled_time
166
+ + web_result.sketch_time
167
+ + web_result.response_processing_time
168
+ + extraction_time
169
+ )
170
+ unaccounted_time = diff - accounted_time
171
+ if extraction_time > 0.01:
172
+ timing_breakdown += f"\n extraction: {extraction_time:.2f}"
173
+ if unaccounted_time > 0.01:
174
+ timing_breakdown += f"\n other overhead: {unaccounted_time:.2f}"
175
+
131
176
  print(
132
- f"\nWeb compilation successful\n Time: {diff:.2f}\n output: {output_dir}\n hash: {hash_value}\n zip size: {len(web_result.zip_bytes)} bytes"
177
+ f"\nWeb compilation successful\n{timing_breakdown}\n output: {output_dir}\n hash: {hash_value}\n zip size: {len(web_result.zip_bytes)} bytes"
133
178
  )
134
179
 
135
180
  # now check to see if the hash value is the same as the last hash value
@@ -138,20 +183,6 @@ def _run_web_compiler(
138
183
  print_results()
139
184
  return web_result
140
185
 
141
- # Extract zip contents to fastled_js directory
142
- output_dir.mkdir(exist_ok=True)
143
- with tempfile.TemporaryDirectory() as temp_dir:
144
- temp_path = Path(temp_dir)
145
- temp_zip = temp_path / "result.zip"
146
- temp_zip.write_bytes(web_result.zip_bytes)
147
-
148
- # Clear existing contents
149
- shutil.rmtree(output_dir, ignore_errors=True)
150
- output_dir.mkdir(exist_ok=True)
151
-
152
- # Extract zip contents
153
- shutil.unpack_archive(temp_zip, output_dir, "zip")
154
-
155
186
  _chunked_print(web_result.stdout)
156
187
  print_results()
157
188
  return web_result
fastled/types.py CHANGED
@@ -12,6 +12,10 @@ class CompileResult:
12
12
  stdout: str
13
13
  hash_value: str | None
14
14
  zip_bytes: bytes
15
+ zip_time: float
16
+ libfastled_time: float
17
+ sketch_time: float
18
+ response_processing_time: float
15
19
 
16
20
  def __bool__(self) -> bool:
17
21
  return self.success
fastled/web_compile.py CHANGED
@@ -196,16 +196,30 @@ def _process_compile_response(
196
196
  response: httpx.Response,
197
197
  zip_result: ZipResult,
198
198
  start_time: float,
199
+ zip_time: float,
200
+ libfastled_time: float,
201
+ sketch_time: float,
199
202
  ) -> CompileResult:
200
203
  """Process the compile response and return the final result."""
201
204
  if response.status_code != 200:
202
205
  json_response = response.json()
203
206
  detail = json_response.get("detail", "Could not compile")
204
207
  return CompileResult(
205
- success=False, stdout=detail, hash_value=None, zip_bytes=b""
208
+ success=False,
209
+ stdout=detail,
210
+ hash_value=None,
211
+ zip_bytes=b"",
212
+ zip_time=zip_time,
213
+ libfastled_time=libfastled_time,
214
+ sketch_time=sketch_time,
215
+ response_processing_time=0.0, # No response processing in error case
206
216
  )
207
217
 
208
218
  print(f"Response status code: {response}")
219
+
220
+ # Time the response processing
221
+ response_processing_start = time.time()
222
+
209
223
  # Create a temporary directory to extract the zip
210
224
  with tempfile.TemporaryDirectory() as extract_dir:
211
225
  extract_path = Path(extract_dir)
@@ -250,14 +264,32 @@ def _process_compile_response(
250
264
  relative_path = file_path.relative_to(extract_path)
251
265
  out_zip.write(file_path, relative_path)
252
266
 
267
+ response_processing_time = time.time() - response_processing_start
253
268
  diff_time = time.time() - start_time
254
- msg = f"Compilation success, took {diff_time:.2f} seconds"
269
+
270
+ # Create detailed timing breakdown
271
+ unaccounted_time = diff_time - (
272
+ zip_time + libfastled_time + sketch_time + response_processing_time
273
+ )
274
+ msg = f"Compilation success, took {diff_time:.2f} seconds\n"
275
+ msg += f" zip creation: {zip_time:.2f}\n"
276
+ if libfastled_time > 0:
277
+ msg += f" libfastled: {libfastled_time:.2f}\n"
278
+ msg += f" sketch compile + link: {sketch_time:.2f}\n"
279
+ msg += f" response processing: {response_processing_time:.2f}\n"
280
+ if unaccounted_time > 0.01: # Only show if significant
281
+ msg += f" other overhead: {unaccounted_time:.2f}"
282
+
255
283
  _print_banner(msg)
256
284
  return CompileResult(
257
285
  success=True,
258
286
  stdout=stdout,
259
287
  hash_value=hash_value,
260
288
  zip_bytes=out_buffer.getvalue(),
289
+ zip_time=zip_time,
290
+ libfastled_time=libfastled_time,
291
+ sketch_time=sketch_time,
292
+ response_processing_time=response_processing_time,
261
293
  )
262
294
 
263
295
 
@@ -279,17 +311,35 @@ def web_compile(
279
311
  auth_token = auth_token or AUTH_TOKEN
280
312
  if not directory.exists():
281
313
  raise FileNotFoundError(f"Directory not found: {directory}")
314
+
315
+ # Time the zip creation
316
+ zip_start_time = time.time()
282
317
  zip_result: ZipResult | Exception = zip_files(directory, build_mode=build_mode)
318
+ zip_time = time.time() - zip_start_time
319
+
283
320
  if isinstance(zip_result, Exception):
284
321
  return CompileResult(
285
- success=False, stdout=str(zip_result), hash_value=None, zip_bytes=b""
322
+ success=False,
323
+ stdout=str(zip_result),
324
+ hash_value=None,
325
+ zip_bytes=b"",
326
+ zip_time=zip_time,
327
+ libfastled_time=0.0, # No libfastled compilation in zip error case
328
+ sketch_time=0.0, # No sketch compilation in zip error case
329
+ response_processing_time=0.0, # No response processing in zip error case
286
330
  )
287
331
  zip_bytes = zip_result.zip_bytes
288
332
  print(f"Web compiling on {host}...")
333
+
334
+ # Track timing for each step
335
+ libfastled_time = 0.0
336
+ sketch_time = 0.0
337
+
289
338
  try:
290
339
  # Step 1: Compile libfastled if requested
291
340
  if allow_libcompile:
292
341
  print("Step 1: Compiling libfastled...")
342
+ libfastled_start_time = time.time()
293
343
  try:
294
344
  libfastled_response = _compile_libfastled(host, auth_token, build_mode)
295
345
 
@@ -308,6 +358,10 @@ def web_compile(
308
358
  stdout=stdout,
309
359
  hash_value=None,
310
360
  zip_bytes=b"",
361
+ zip_time=zip_time,
362
+ libfastled_time=libfastled_time,
363
+ sketch_time=0.0, # No sketch compilation when libfastled fails
364
+ response_processing_time=0.0, # No response processing when libfastled fails
311
365
  )
312
366
  else:
313
367
  # Check for embedded HTTP status in response content
@@ -332,6 +386,10 @@ def web_compile(
332
386
  stdout=stdout,
333
387
  hash_value=None,
334
388
  zip_bytes=b"",
389
+ zip_time=zip_time,
390
+ libfastled_time=libfastled_time,
391
+ sketch_time=0.0, # No sketch compilation when libfastled fails
392
+ response_processing_time=0.0, # No response processing when libfastled fails
335
393
  )
336
394
  # Continue with sketch compilation even if libfastled fails
337
395
  elif embedded_status is None:
@@ -343,7 +401,9 @@ def web_compile(
343
401
  print("✅ libfastled compilation successful")
344
402
  else:
345
403
  print("✅ libfastled compilation successful")
404
+ libfastled_time = time.time() - libfastled_start_time
346
405
  except Exception as e:
406
+ libfastled_time = time.time() - libfastled_start_time
347
407
  print(f"Warning: libfastled compilation failed: {e}")
348
408
  # Continue with sketch compilation even if libfastled fails
349
409
  else:
@@ -351,6 +411,7 @@ def web_compile(
351
411
 
352
412
  # Step 2: Compile the sketch
353
413
  print("Step 2: Compiling sketch...")
414
+ sketch_start_time = time.time()
354
415
  response = _send_compile_request(
355
416
  host,
356
417
  zip_bytes,
@@ -360,8 +421,11 @@ def web_compile(
360
421
  no_platformio,
361
422
  False, # allow_libcompile is always False since we handle it manually
362
423
  )
424
+ sketch_time = time.time() - sketch_start_time
363
425
 
364
- return _process_compile_response(response, zip_result, start_time)
426
+ return _process_compile_response(
427
+ response, zip_result, start_time, zip_time, libfastled_time, sketch_time
428
+ )
365
429
 
366
430
  except ConnectionError as e:
367
431
  _print_banner(str(e))
@@ -370,6 +434,10 @@ def web_compile(
370
434
  stdout=str(e),
371
435
  hash_value=None,
372
436
  zip_bytes=b"",
437
+ zip_time=zip_time,
438
+ libfastled_time=libfastled_time,
439
+ sketch_time=sketch_time,
440
+ response_processing_time=0.0, # No response processing in connection error case
373
441
  )
374
442
  except KeyboardInterrupt:
375
443
  print("Keyboard interrupt")
@@ -377,5 +445,12 @@ def web_compile(
377
445
  except httpx.HTTPError as e:
378
446
  print(f"Error: {e}")
379
447
  return CompileResult(
380
- success=False, stdout=str(e), hash_value=None, zip_bytes=b""
448
+ success=False,
449
+ stdout=str(e),
450
+ hash_value=None,
451
+ zip_bytes=b"",
452
+ zip_time=zip_time,
453
+ libfastled_time=libfastled_time,
454
+ sketch_time=sketch_time,
455
+ response_processing_time=0.0, # No response processing in HTTP error case
381
456
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.4.32
3
+ Version: 1.4.33
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -1,12 +1,12 @@
1
1
  fastled/__init__.py,sha256=dahiY41HLLotTjqmpVJmXSwUEp8NKqoZ57jt55hBLa4,7667
2
2
  fastled/__main__.py,sha256=OcKv2ER1_iQAsZzLIUb3C8hRC9L2clNOhCrjpshrlf4,336
3
- fastled/__version__.py,sha256=-bXrpXNCrm6sdISaMv0IsTnqU5xEbH1LoWKWoAP4o8k,373
3
+ fastled/__version__.py,sha256=XxwvFC9H7PYpQBVw-iB_I-L1M2FcSBtu5BVhMpuqNCM,373
4
4
  fastled/app.py,sha256=ofuUkDape1-2bjrRYFhi8Ehg96h5FoiBOkb-_cD4I_o,6490
5
5
  fastled/args.py,sha256=LtYgskJjy1k47nrTBJ-5rXrNelO4TbexT92o3sR0dlk,4531
6
6
  fastled/cli.py,sha256=drgR2AOxVrj3QEz58iiKscYAumbbin2vIV-k91VCOAA,561
7
7
  fastled/cli_test.py,sha256=W-1nODZrip_JU6BEbYhxOa4ckxduOsiX8zIoRkTyxv4,550
8
8
  fastled/cli_test_interactive.py,sha256=BjNhveZOk5aCffHbcrxPQQjWmAuj4ClVKKcKX5eY6yM,542
9
- fastled/client_server.py,sha256=uGUZkK8Qvw_Y5sPQ6j1OYMrlb7zbmPYk547yYxum70c,23097
9
+ fastled/client_server.py,sha256=uVVOr7-NP9PgHjVrfMJmhmLWjS1IsP62y0VMfv17uNw,24490
10
10
  fastled/compile_server.py,sha256=iGUjteXKp5Dlp7mxAE4eD4s0NWgApRIp4ZjtcAN2iZY,3124
11
11
  fastled/compile_server_impl.py,sha256=iCwNCs7YxypUuVPmY4979mOgoH9OiuAJa1a1bmpG1cc,12567
12
12
  fastled/docker_manager.py,sha256=c0-DBA4_YtCl2XgtohL6uKtW0TK6vkHO0o2vympZShg,41089
@@ -28,10 +28,10 @@ fastled/settings.py,sha256=8RLN3S0ZK4DMphr0gKPfwPKfwIzOtHiQsqMTpGnX7Xg,1842
28
28
  fastled/sketch.py,sha256=Ftbh55Nt-p4hmPuPpj8Q9HrMzvnUazhoG_q9FHcxkns,3473
29
29
  fastled/spinner.py,sha256=VHxmvB92P0Z_zYxRajb5HiNmkHHvZ5dG7hKtZltzpcs,867
30
30
  fastled/string_diff.py,sha256=oTncu0qYdLlLUtYLLDB4bzdQ2OfzegAR6XNAzwE9fIs,6002
31
- fastled/types.py,sha256=ZDf1TbTT4XgA_pKIwr4JbkDB38_29ogSdDORjoT-zuY,1803
31
+ fastled/types.py,sha256=tBikcoKjbBcCTi36MMCz_TjMEBoa-FppRL-yKAVwXFc,1909
32
32
  fastled/util.py,sha256=TjhXbUNh4p2BGhNAldSeL68B7BBOjsWAXji5gy-vDEQ,1440
33
33
  fastled/version.py,sha256=TpBMiEVdO3_sUZEu6wmwN8Q4AgX2BiCxStCsnPKh6E0,1209
34
- fastled/web_compile.py,sha256=NgRKAcQ_sJLUdg-lrYS7U27VF63nsQipHCd4Pm7ka94,13347
34
+ fastled/web_compile.py,sha256=th_uswHLNsoSMKZS4PjowR7lc1moDkPpe63lhMC3YM4,16479
35
35
  fastled/zip_files.py,sha256=BgHFjaLJ7wF6mnzjqOgn76VcKDwhwc_-w_qyUG_-aNs,2815
36
36
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
37
37
  fastled/assets/localhost-key.pem,sha256=Q-CNO_UoOd8fFNN4ljcnqwUeCMhzTplRjLO2x0pYRlU,1704
@@ -50,9 +50,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
50
50
  fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
51
51
  fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
52
52
  fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
53
- fastled-1.4.32.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
54
- fastled-1.4.32.dist-info/METADATA,sha256=dg7a2fbEKpdayjVfE1vpoW6RjotAL1tYceeByN94fag,31910
55
- fastled-1.4.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
- fastled-1.4.32.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
57
- fastled-1.4.32.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
58
- fastled-1.4.32.dist-info/RECORD,,
53
+ fastled-1.4.33.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
54
+ fastled-1.4.33.dist-info/METADATA,sha256=hQHOL7FqOi22WjKbLsylw-huO_l0P94ERo7izu62CKQ,31910
55
+ fastled-1.4.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
+ fastled-1.4.33.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
57
+ fastled-1.4.33.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
58
+ fastled-1.4.33.dist-info/RECORD,,