fastled 1.1.26__py2.py3-none-any.whl → 1.1.28__py2.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/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
- """FastLED Wasm Compiler package."""
2
-
3
- __version__ = "1.1.26"
1
+ """FastLED Wasm Compiler package."""
2
+
3
+ __version__ = "1.1.28"
fastled/app.py CHANGED
@@ -154,7 +154,10 @@ def parse_args() -> argparse.Namespace:
154
154
  def run_server(args: argparse.Namespace) -> int:
155
155
  interactive = args.interactive
156
156
  auto_update = args.auto_update
157
- compile_server = CompileServer(interactive=interactive, auto_updates=auto_update)
157
+ mapped_dir = Path(args.directory).absolute() if args.directory else None
158
+ compile_server = CompileServer(
159
+ interactive=interactive, auto_updates=auto_update, mapped_dir=mapped_dir
160
+ )
158
161
  if not interactive:
159
162
  print(f"Server started at {compile_server.url()}")
160
163
  compile_server.wait_for_startup()
fastled/client_server.py CHANGED
@@ -1,8 +1,8 @@
1
1
  import argparse
2
2
  import shutil
3
- import subprocess
4
3
  import tempfile
5
4
  import time
5
+ from multiprocessing import Process
6
6
  from pathlib import Path
7
7
 
8
8
  from fastled.build_mode import BuildMode, get_build_mode
@@ -11,7 +11,7 @@ from fastled.docker_manager import DockerManager
11
11
  from fastled.env import DEFAULT_URL
12
12
  from fastled.filewatcher import FileWatcherProcess
13
13
  from fastled.keyboard import SpaceBarWatcher
14
- from fastled.open_browser import open_browser_thread
14
+ from fastled.open_browser import open_browser_process
15
15
  from fastled.sketch import looks_like_sketch_directory
16
16
 
17
17
  # CompiledResult
@@ -181,9 +181,9 @@ def run_client_server(args: argparse.Namespace) -> int:
181
181
  if not result.success:
182
182
  print("\nCompilation failed.")
183
183
 
184
- browser_proc: subprocess.Popen | None = None
184
+ browser_proc: Process | None = None
185
185
  if open_web_browser:
186
- browser_proc = open_browser_thread(Path(args.directory) / "fastled_js")
186
+ browser_proc = open_browser_process(Path(args.directory) / "fastled_js")
187
187
  else:
188
188
  print("\nCompilation successful.")
189
189
  if compile_server:
fastled/compile_server.py CHANGED
@@ -27,8 +27,14 @@ class CompileServer:
27
27
  container_name=_DEFAULT_CONTAINER_NAME,
28
28
  interactive: bool = False,
29
29
  auto_updates: bool | None = None,
30
+ mapped_dir: Path | None = None,
30
31
  ) -> None:
31
-
32
+ if interactive and not mapped_dir:
33
+ raise ValueError(
34
+ "Interactive mode requires a mapped directory point to a sketch"
35
+ )
36
+ if not interactive and mapped_dir:
37
+ raise ValueError("Mapped directory is only used in interactive mode")
32
38
  cwd = Path(".").resolve()
33
39
  fastled_src_dir: Path | None = None
34
40
  if looks_like_fastled_repo(cwd):
@@ -38,6 +44,7 @@ class CompileServer:
38
44
  fastled_src_dir = cwd / "src"
39
45
 
40
46
  self.container_name = container_name
47
+ self.mapped_dir = mapped_dir
41
48
  self.docker = DockerManager()
42
49
  self.fastled_src_dir: Path | None = fastled_src_dir
43
50
  self.interactive = interactive
@@ -133,6 +140,19 @@ class CompileServer:
133
140
  volumes = {
134
141
  str(self.fastled_src_dir): {"bind": "/host/fastled/src", "mode": "ro"}
135
142
  }
143
+ if self.interactive:
144
+ # add the mapped directory to the container
145
+ print(f"Mounting {self.mapped_dir} into container /mapped")
146
+ # volumes = {str(self.mapped_dir): {"bind": "/mapped", "mode": "rw"}}
147
+ # add it
148
+ assert self.mapped_dir is not None
149
+ dir_name = self.mapped_dir.name
150
+ if not volumes:
151
+ volumes = {}
152
+ volumes[str(self.mapped_dir)] = {
153
+ "bind": f"/mapped/{dir_name}",
154
+ "mode": "rw",
155
+ }
136
156
 
137
157
  cmd_str = subprocess.list2cmdline(server_command)
138
158
  if not self.interactive:
fastled/open_browser.py CHANGED
@@ -1,35 +1,23 @@
1
+ import os
1
2
  import socket
2
- import subprocess
3
+ import sys
4
+ from multiprocessing import Process
3
5
  from pathlib import Path
4
6
 
7
+ from livereload import Server
8
+
5
9
  DEFAULT_PORT = 8081
6
10
 
7
11
 
8
- def _open_browser_python(fastled_js: Path, port: int) -> subprocess.Popen:
9
- """Start livereload server in the fastled_js directory using CLI"""
12
+ def _open_browser_python(fastled_js: Path, port: int) -> Server:
13
+ """Start livereload server in the fastled_js directory using API"""
10
14
  print(f"\nStarting livereload server in {fastled_js} on port {port}")
11
15
 
12
- # Construct command for livereload CLI
13
- cmd = [
14
- "livereload",
15
- str(fastled_js), # directory to serve
16
- "--port",
17
- str(port),
18
- "-t",
19
- str(fastled_js / "index.html"), # file to watch
20
- "-w",
21
- "0.1", # delay
22
- "-o",
23
- "0.5", # open browser delay
24
- ]
25
-
26
- # Start the process
27
- process = subprocess.Popen(
28
- cmd,
29
- # stdout=subprocess.DEVNULL,
30
- stderr=subprocess.DEVNULL,
31
- )
32
- return process
16
+ server = Server()
17
+ server.watch(str(fastled_js / "index.html"), delay=0.1)
18
+ server.setHeader("Cache-Control", "no-cache")
19
+ server.serve(root=str(fastled_js), port=port, open_url_delay=0.5)
20
+ return server
33
21
 
34
22
 
35
23
  def _find_open_port(start_port: int) -> int:
@@ -42,11 +30,29 @@ def _find_open_port(start_port: int) -> int:
42
30
  port += 1
43
31
 
44
32
 
45
- def open_browser_thread(fastled_js: Path, port: int | None = None) -> subprocess.Popen:
46
- """Start livereload server in the fastled_js directory and return the started thread"""
33
+ def _run_server(fastled_js: Path, port: int) -> None:
34
+ """Function to run in separate process that starts the livereload server"""
35
+ sys.stderr = open(os.devnull, "w") # Suppress stderr output
36
+ _open_browser_python(fastled_js, port)
37
+ try:
38
+ # Keep the process running
39
+ while True:
40
+ pass
41
+ except KeyboardInterrupt:
42
+ print("\nShutting down livereload server...")
43
+
44
+
45
+ def open_browser_process(fastled_js: Path, port: int | None = None) -> Process:
46
+ """Start livereload server in the fastled_js directory and return the process"""
47
47
  if port is None:
48
48
  port = DEFAULT_PORT
49
49
 
50
50
  port = _find_open_port(port)
51
51
 
52
- return _open_browser_python(fastled_js, port)
52
+ process = Process(
53
+ target=_run_server,
54
+ args=(fastled_js, port),
55
+ daemon=True,
56
+ )
57
+ process.start()
58
+ return process
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.26
3
+ Version: 1.1.28
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -165,7 +165,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
165
165
 
166
166
  # Revisions
167
167
 
168
- * 1.1.26 - Fixed `--interactive` so that it now works correctly.
168
+ * 1.1.28 - Adds cache control headers to the live server to disable all caching in the live browser.
169
+ * 1.1.27 - Fixed `--interactive` so that it now works correctly.
169
170
  * 1.1.25 - Improved detecting which sketch directory the user means by fuzzy matching.
170
171
  * 1.1.24 - Adds progress spinning bar for pulling images, which take a long time.
171
172
  * 1.1.23 - Various fixes for MacOS
@@ -1,14 +1,14 @@
1
- fastled/__init__.py,sha256=5-jQK-HR_0kUeBf2hyQ72AApd6GSPIjapr6fk2DY-Dg,64
2
- fastled/app.py,sha256=U8JN0VGC2adw6BKC7INco4iDG5zLj4L2Etzr9smWyeQ,6861
1
+ fastled/__init__.py,sha256=HMXRAUlJ0qqTwg5n-j-Bgndq0EzWjp-bqu6VcSiNeq4,61
2
+ fastled/app.py,sha256=oL_IXsYxDRaw9eU2aSkCZ57xAUedbNWT4-WwCsJT2Sc,6978
3
3
  fastled/build_mode.py,sha256=joMwsV4K1y_LijT4gEAcjx69RZBoe_KmFmHZdPYbL_4,631
4
4
  fastled/cli.py,sha256=CNR_pQR0sNVPNuv8e_nmm-0PI8sU-eUBUgnWgWkzW9c,237
5
- fastled/client_server.py,sha256=KdjgAiYJ2mKXIfYVFcVZtVDtbZhzkjqrzatAwNa_QWw,11437
6
- fastled/compile_server.py,sha256=rtAW9zllb8WOSzhoRUMtdMGDzYFL4CtyoWVa7Y-jK24,5810
5
+ fastled/client_server.py,sha256=IK_u71XbmOAKBX1ovHATsCmfUON8VVJJu-XtObTuYJI,11448
6
+ fastled/compile_server.py,sha256=Adb2lvJ_p6Ui7UMxijRtYJhbO4YPTERKVQeuoQgibSE,6724
7
7
  fastled/docker_manager.py,sha256=Ok8TC1JXMoNMWt4P9clFFEVE29Xd-4C_MvIMIfvNo78,22134
8
8
  fastled/env.py,sha256=8wctQwl5qE4CI8NBugHtgMmUfEfHZ869JX5lGdSOJxc,304
9
9
  fastled/filewatcher.py,sha256=5dVmjEG23kMeJa29tRVm5XKSr9sTD4ME2boo-CFDuUM,6910
10
10
  fastled/keyboard.py,sha256=Zz_ggxOUTX2XQEy6K6kAoorVlUev4wEk9Awpvv9aStA,3241
11
- fastled/open_browser.py,sha256=RRHcsZ5Vzsw1AuZUEYuSfjKmf_9j3NGMDUR-FndHmqs,1483
11
+ fastled/open_browser.py,sha256=-2_vyf6dbi2xGex-CMZHVVcXvwXGJkLOwFcjHGxknUQ,1769
12
12
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
13
13
  fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffER2NfM,1314
14
14
  fastled/sketch.py,sha256=5nRjg281lMH8Bo9wKjbcpTQCfEP574ZCG-lukvFmyQ8,2656
@@ -18,9 +18,9 @@ fastled/types.py,sha256=dDIsGHJkHNJ7B61wNp6X0JSLs_nrHiq7RlNqNWbwFec,194
18
18
  fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
19
19
  fastled/web_compile.py,sha256=KuvKGdX6SSUUqC7YgX4T9SMSP5wdcPUhpg9-K9zPoTI,10378
20
20
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
21
- fastled-1.1.26.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
22
- fastled-1.1.26.dist-info/METADATA,sha256=Sp3HqgomtVTcvohI_6j5V1z6xt7GpKWZjgmhRSPOjLs,14324
23
- fastled-1.1.26.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
24
- fastled-1.1.26.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
25
- fastled-1.1.26.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
26
- fastled-1.1.26.dist-info/RECORD,,
21
+ fastled-1.1.28.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
22
+ fastled-1.1.28.dist-info/METADATA,sha256=j1WPsQq5G-YdMkuogYjcJKvO-X75I3Fo5oarOa-hTXA,14428
23
+ fastled-1.1.28.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
24
+ fastled-1.1.28.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
25
+ fastled-1.1.28.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
26
+ fastled-1.1.28.dist-info/RECORD,,