fastled 1.4.5__py3-none-any.whl → 1.4.7__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.5"
4
+ __version__ = "1.4.7"
5
5
 
6
6
  __version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
@@ -17,7 +17,6 @@ from typing import Any
17
17
  # Set custom Playwright browser installation path
18
18
  PLAYWRIGHT_DIR = Path.home() / ".fastled" / "playwright"
19
19
  PLAYWRIGHT_DIR.mkdir(parents=True, exist_ok=True)
20
- os.environ["PLAYWRIGHT_BROWSERS_PATH"] = str(PLAYWRIGHT_DIR)
21
20
 
22
21
  try:
23
22
  from playwright.async_api import Browser, Page, async_playwright
@@ -35,6 +34,36 @@ def is_playwright_available() -> bool:
35
34
  return PLAYWRIGHT_AVAILABLE
36
35
 
37
36
 
37
+ def get_chromium_executable_path() -> str | None:
38
+ """Get the path to the custom Chromium executable if it exists."""
39
+ import glob
40
+ import platform
41
+
42
+ playwright_dir = PLAYWRIGHT_DIR
43
+
44
+ if platform.system() == "Windows":
45
+ chromium_pattern = str(
46
+ playwright_dir / "chromium-*" / "chrome-win" / "chrome.exe"
47
+ )
48
+ elif platform.system() == "Darwin": # macOS
49
+ chromium_pattern = str(
50
+ playwright_dir
51
+ / "chromium-*"
52
+ / "chrome-mac"
53
+ / "Chromium.app"
54
+ / "Contents"
55
+ / "MacOS"
56
+ / "Chromium"
57
+ )
58
+ else: # Linux
59
+ chromium_pattern = str(
60
+ playwright_dir / "chromium-*" / "chrome-linux" / "chrome"
61
+ )
62
+
63
+ matches = glob.glob(chromium_pattern)
64
+ return matches[0] if matches else None
65
+
66
+
38
67
  class PlaywrightBrowser:
39
68
  """Playwright browser manager for FastLED sketches."""
40
69
 
@@ -113,14 +142,25 @@ class PlaywrightBrowser:
113
142
 
114
143
  self.playwright = async_playwright()
115
144
  playwright = await self.playwright.start()
116
- self.browser = await playwright.chromium.launch(
117
- headless=self.headless,
118
- args=[
145
+
146
+ # Get custom Chromium executable path if available
147
+ executable_path = get_chromium_executable_path()
148
+ launch_kwargs = {
149
+ "headless": self.headless,
150
+ "args": [
119
151
  "--disable-dev-shm-usage",
120
152
  "--disable-web-security",
121
153
  "--allow-running-insecure-content",
122
154
  ],
123
- )
155
+ }
156
+
157
+ if executable_path:
158
+ launch_kwargs["executable_path"] = executable_path
159
+ print(
160
+ f"[PYTHON] Using custom Chromium executable: {executable_path}"
161
+ )
162
+
163
+ self.browser = await playwright.chromium.launch(**launch_kwargs)
124
164
  else:
125
165
  raise RuntimeError("Playwright is not available")
126
166
 
@@ -454,8 +494,6 @@ class PlaywrightBrowserProxy:
454
494
  if self.monitor_thread is not None:
455
495
  return
456
496
 
457
- import os
458
-
459
497
  def monitor_process():
460
498
  """Monitor the browser process and exit when it terminates."""
461
499
  if self.process is None:
@@ -594,30 +632,38 @@ def install_playwright_browsers() -> bool:
594
632
  playwright_dir = Path.home() / ".fastled" / "playwright"
595
633
  playwright_dir.mkdir(parents=True, exist_ok=True)
596
634
 
597
- # Set environment variable for Playwright browser path
598
- os.environ["PLAYWRIGHT_BROWSERS_PATH"] = str(playwright_dir)
635
+ # Check if browsers are installed in the custom directory
636
+ import glob
637
+ import platform
599
638
 
600
- from playwright.sync_api import sync_playwright
639
+ if platform.system() == "Windows":
640
+ chromium_pattern = str(
641
+ playwright_dir / "chromium-*" / "chrome-win" / "chrome.exe"
642
+ )
643
+ elif platform.system() == "Darwin": # macOS
644
+ chromium_pattern = str(
645
+ playwright_dir / "chromium-*" / "chrome-mac" / "Chromium.app"
646
+ )
647
+ else: # Linux
648
+ chromium_pattern = str(
649
+ playwright_dir / "chromium-*" / "chrome-linux" / "chrome"
650
+ )
601
651
 
602
- with sync_playwright() as p:
603
- # Try to launch a browser to see if it's installed
604
- try:
605
- browser = p.chromium.launch(headless=True)
606
- browser.close()
607
- return True
608
- except Exception:
609
- pass
652
+ if glob.glob(chromium_pattern):
653
+ print(f"✅ Playwright browsers already installed at: {playwright_dir}")
654
+ return True
610
655
 
611
656
  # If we get here, browsers need to be installed
612
657
  print("Installing Playwright browsers...")
613
658
  print(f"Installing to: {playwright_dir}")
614
659
  import subprocess
615
660
 
661
+ env = dict(os.environ)
662
+ env["PLAYWRIGHT_BROWSERS_PATH"] = str(playwright_dir.resolve())
663
+
616
664
  result = subprocess.run(
617
665
  [sys.executable, "-m", "playwright", "install", "chromium"],
618
- capture_output=True,
619
- text=True,
620
- env=dict(os.environ, PLAYWRIGHT_BROWSERS_PATH=str(playwright_dir)),
666
+ env=env,
621
667
  )
622
668
 
623
669
  if result.returncode == 0:
@@ -625,7 +671,9 @@ def install_playwright_browsers() -> bool:
625
671
  print(f" Location: {playwright_dir}")
626
672
  return True
627
673
  else:
628
- print(f"❌ Failed to install Playwright browsers: {result.stderr}")
674
+ print(
675
+ f"❌ Failed to install Playwright browsers (exit code: {result.returncode})"
676
+ )
629
677
  return False
630
678
 
631
679
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.4.5
3
+ Version: 1.4.7
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -1,6 +1,6 @@
1
1
  fastled/__init__.py,sha256=l4uDkh_YOd24okNfn6eWjtTYaZ0woeYC7khv-vHMmTM,7775
2
2
  fastled/__main__.py,sha256=OcKv2ER1_iQAsZzLIUb3C8hRC9L2clNOhCrjpshrlf4,336
3
- fastled/__version__.py,sha256=B4ZqzHwXA9uCBNwRrujcvuXXm2l56Enp2DP18gCaohg,372
3
+ fastled/__version__.py,sha256=IIHIBgMnSIjry_2fDsUJNCOPtgR7hfhktRPPy1zDVjo,372
4
4
  fastled/app.py,sha256=6XOuObi72AUnZXASDOVbcSflr4He0xnIDk5P8nVmVus,6131
5
5
  fastled/args.py,sha256=uCMyRIYM8gFE52O12YKUfA-rwJL8Zxwk_hsH3cusSac,3669
6
6
  fastled/cli.py,sha256=drgR2AOxVrj3QEz58iiKscYAumbbin2vIV-k91VCOAA,561
@@ -18,7 +18,7 @@ fastled/live_client.py,sha256=aDZqSWDMpqNaEsT3u1nrBcdeIOItv-L0Gk2A10difLA,3209
18
18
  fastled/open_browser.py,sha256=mwjm65p2ydwmsaar7ooH4mhT5_qH_LZvXUpkRPPJ9eA,4881
19
19
  fastled/parse_args.py,sha256=htjap9tWZDJXnJ5upDwcy8EhecJD1uLZwacHR_T5ySs,11518
20
20
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
21
- fastled/playwright_browser.py,sha256=acnp_mdADSlCmWJkvQJETHHRsajQjrdHuKiQGT_V6Mc,22868
21
+ fastled/playwright_browser.py,sha256=wa_MCrF_JqTDK635OCoL73Fwu2jbjsOZx5XNT_aKVbg,24379
22
22
  fastled/print_filter.py,sha256=nc_rqYYdCUPinFycaK7fiQF5PG1up51pmJptR__QyAs,1499
23
23
  fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
24
24
  fastled/select_sketch_directory.py,sha256=-eudwCns3AKj4HuHtSkZAFwbnf005SNL07pOzs9VxnE,1383
@@ -40,9 +40,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
40
40
  fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
41
41
  fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
42
42
  fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
43
- fastled-1.4.5.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
44
- fastled-1.4.5.dist-info/METADATA,sha256=FTgtOasheiABxVui1GCO4MXKXxeEFmjh3XVfQ2ydrcQ,32369
45
- fastled-1.4.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- fastled-1.4.5.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
47
- fastled-1.4.5.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
48
- fastled-1.4.5.dist-info/RECORD,,
43
+ fastled-1.4.7.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
44
+ fastled-1.4.7.dist-info/METADATA,sha256=djjNFRmkP71_6fnaTspzQ3Txpb2I35VjjRjPW20yt6c,32369
45
+ fastled-1.4.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ fastled-1.4.7.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
47
+ fastled-1.4.7.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
48
+ fastled-1.4.7.dist-info/RECORD,,