fastled 1.2.30__tar.gz → 1.2.32__tar.gz

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.
Files changed (88) hide show
  1. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/publish_release.yml +1 -1
  2. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/test_build_exe.yml +1 -1
  3. {fastled-1.2.30 → fastled-1.2.32}/PKG-INFO +2 -1
  4. {fastled-1.2.30 → fastled-1.2.32}/README.md +1 -0
  5. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/__init__.py +60 -22
  6. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/app.py +28 -30
  7. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/compile_server.py +6 -0
  8. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/compile_server_impl.py +6 -2
  9. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/filewatcher.py +13 -0
  10. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/live_client.py +5 -0
  11. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/test/examples.py +1 -0
  12. {fastled-1.2.30 → fastled-1.2.32}/src/fastled.egg-info/PKG-INFO +2 -1
  13. {fastled-1.2.30 → fastled-1.2.32}/src/fastled.egg-info/SOURCES.txt +2 -0
  14. {fastled-1.2.30 → fastled-1.2.32}/tests/test_build.py +5 -5
  15. fastled-1.2.32/tests/test_build_from_docker.py +47 -0
  16. fastled-1.2.32/tests/test_build_from_github.py +46 -0
  17. {fastled-1.2.30 → fastled-1.2.32}/.aiderignore +0 -0
  18. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/build_multi_docker_image.yml +0 -0
  19. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/build_webpage.yml +0 -0
  20. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/lint.yml +0 -0
  21. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/test_macos.yml +0 -0
  22. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/test_ubuntu.yml +0 -0
  23. {fastled-1.2.30 → fastled-1.2.32}/.github/workflows/test_win.yml +0 -0
  24. {fastled-1.2.30 → fastled-1.2.32}/.gitignore +0 -0
  25. {fastled-1.2.30 → fastled-1.2.32}/.pylintrc +0 -0
  26. {fastled-1.2.30 → fastled-1.2.32}/.vscode/launch.json +0 -0
  27. {fastled-1.2.30 → fastled-1.2.32}/.vscode/settings.json +0 -0
  28. {fastled-1.2.30 → fastled-1.2.32}/.vscode/tasks.json +0 -0
  29. {fastled-1.2.30 → fastled-1.2.32}/LICENSE +0 -0
  30. {fastled-1.2.30 → fastled-1.2.32}/MANIFEST.in +0 -0
  31. {fastled-1.2.30 → fastled-1.2.32}/RELEASE.md +0 -0
  32. {fastled-1.2.30 → fastled-1.2.32}/TODO.md +0 -0
  33. {fastled-1.2.30 → fastled-1.2.32}/build_exe.py +0 -0
  34. {fastled-1.2.30 → fastled-1.2.32}/build_site.py +0 -0
  35. {fastled-1.2.30 → fastled-1.2.32}/clean +0 -0
  36. {fastled-1.2.30 → fastled-1.2.32}/install +0 -0
  37. {fastled-1.2.30 → fastled-1.2.32}/install_linux.sh +0 -0
  38. {fastled-1.2.30 → fastled-1.2.32}/lint +0 -0
  39. {fastled-1.2.30 → fastled-1.2.32}/pyproject.toml +0 -0
  40. {fastled-1.2.30 → fastled-1.2.32}/requirements.testing.txt +0 -0
  41. {fastled-1.2.30 → fastled-1.2.32}/setup.cfg +0 -0
  42. {fastled-1.2.30 → fastled-1.2.32}/setup.py +0 -0
  43. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/assets/example.txt +0 -0
  44. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/cli.py +0 -0
  45. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/client_server.py +0 -0
  46. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/docker_manager.py +0 -0
  47. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/keyboard.py +0 -0
  48. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/open_browser.py +0 -0
  49. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/open_browser2.py +0 -0
  50. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/parse_args.py +0 -0
  51. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/paths.py +0 -0
  52. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/project_init.py +0 -0
  53. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/select_sketch_directory.py +0 -0
  54. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/settings.py +0 -0
  55. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/site/build.py +0 -0
  56. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/sketch.py +0 -0
  57. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/spinner.py +0 -0
  58. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/string_diff.py +0 -0
  59. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/test/can_run_local_docker_tests.py +0 -0
  60. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/types.py +0 -0
  61. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/util.py +0 -0
  62. {fastled-1.2.30 → fastled-1.2.32}/src/fastled/web_compile.py +0 -0
  63. {fastled-1.2.30 → fastled-1.2.32}/src/fastled.egg-info/dependency_links.txt +0 -0
  64. {fastled-1.2.30 → fastled-1.2.32}/src/fastled.egg-info/entry_points.txt +0 -0
  65. {fastled-1.2.30 → fastled-1.2.32}/src/fastled.egg-info/requires.txt +0 -0
  66. {fastled-1.2.30 → fastled-1.2.32}/src/fastled.egg-info/top_level.txt +0 -0
  67. {fastled-1.2.30 → fastled-1.2.32}/test +0 -0
  68. {fastled-1.2.30 → fastled-1.2.32}/tests/html/index.html +0 -0
  69. {fastled-1.2.30 → fastled-1.2.32}/tests/test_api.py +0 -0
  70. {fastled-1.2.30 → fastled-1.2.32}/tests/test_bad_ino.py +0 -0
  71. {fastled-1.2.30 → fastled-1.2.32}/tests/test_build_examples.py +0 -0
  72. {fastled-1.2.30 → fastled-1.2.32}/tests/test_cli.py +0 -0
  73. {fastled-1.2.30 → fastled-1.2.32}/tests/test_compile_server.py +0 -0
  74. {fastled-1.2.30 → fastled-1.2.32}/tests/test_docker_linux_on_windows.py +0 -0
  75. {fastled-1.2.30 → fastled-1.2.32}/tests/test_embedded_data.py +0 -0
  76. {fastled-1.2.30 → fastled-1.2.32}/tests/test_examples.py +0 -0
  77. {fastled-1.2.30 → fastled-1.2.32}/tests/test_filechanger.py +0 -0
  78. {fastled-1.2.30 → fastled-1.2.32}/tests/test_http_server.py +0 -0
  79. {fastled-1.2.30 → fastled-1.2.32}/tests/test_ino/bad/bad.ino +0 -0
  80. {fastled-1.2.30 → fastled-1.2.32}/tests/test_ino/bad_platformio/bad_platformio.ino +0 -0
  81. {fastled-1.2.30 → fastled-1.2.32}/tests/test_ino/bad_platformio/platformio.ini +0 -0
  82. {fastled-1.2.30 → fastled-1.2.32}/tests/test_ino/embedded/data/bigdata.dat +0 -0
  83. {fastled-1.2.30 → fastled-1.2.32}/tests/test_ino/embedded/wasm.ino +0 -0
  84. {fastled-1.2.30 → fastled-1.2.32}/tests/test_ino/wasm/wasm.ino +0 -0
  85. {fastled-1.2.30 → fastled-1.2.32}/tests/test_project_init.py +0 -0
  86. {fastled-1.2.30 → fastled-1.2.32}/tests/test_server_and_client_seperatly.py +0 -0
  87. {fastled-1.2.30 → fastled-1.2.32}/tests/test_webcompile.py +0 -0
  88. {fastled-1.2.30 → fastled-1.2.32}/upload_package.sh +0 -0
@@ -121,7 +121,7 @@ jobs:
121
121
 
122
122
 
123
123
  - name: Upload artifact
124
- uses: actions/upload-artifact@v3
124
+ uses: actions/upload-artifact@v4
125
125
  with:
126
126
  name: fastled-${{ runner.os }}-${{ runner.arch }}
127
127
  path: |
@@ -46,7 +46,7 @@ jobs:
46
46
  fi
47
47
 
48
48
  - name: Upload artifacts
49
- uses: actions/upload-artifact@v3
49
+ uses: actions/upload-artifact@v4
50
50
  with:
51
51
  name: fastled-${{ matrix.os }}
52
52
  path: |
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fastled
3
- Version: 1.2.30
3
+ Version: 1.2.32
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -295,6 +295,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
295
295
 
296
296
  # Revisions
297
297
 
298
+ * 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
298
299
  * 1.2.22 - Prefer to use `live-server` from npm. If npm exists on the system then do a background install of `live-server` for next run.
299
300
  * 1.2.20 - Fixed up path issue for web browser launch for hot reload.
300
301
  * 1.2.19 - Compilation failure now overwrites the index.html file with error message.
@@ -269,6 +269,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
269
269
 
270
270
  # Revisions
271
271
 
272
+ * 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
272
273
  * 1.2.22 - Prefer to use `live-server` from npm. If npm exists on the system then do a background install of `live-server` for next run.
273
274
  * 1.2.20 - Fixed up path issue for web browser launch for hot reload.
274
275
  * 1.2.19 - Compilation failure now overwrites the index.html file with error message.
@@ -1,6 +1,7 @@
1
1
  """FastLED Wasm Compiler package."""
2
2
 
3
3
  # context
4
+ import shutil
4
5
  import subprocess
5
6
  from contextlib import contextmanager
6
7
  from multiprocessing import Process
@@ -15,7 +16,7 @@ from .types import BuildMode, CompileResult, CompileServerError
15
16
  # IMPORTANT! There's a bug in github which will REJECT any version update
16
17
  # that has any other change in the repo. Please bump the version as the
17
18
  # ONLY change in a commit, or else the pypi update and the release will fail.
18
- __version__ = "1.2.30"
19
+ __version__ = "1.2.32"
19
20
 
20
21
 
21
22
  class Api:
@@ -60,6 +61,7 @@ class Api:
60
61
  def live_client(
61
62
  sketch_directory: Path,
62
63
  host: str | CompileServer | None = None,
64
+ auto_updates: bool = True,
63
65
  auto_start=True,
64
66
  open_web_browser=True,
65
67
  keep_running=True,
@@ -69,6 +71,7 @@ class Api:
69
71
  return LiveClient(
70
72
  sketch_directory=sketch_directory,
71
73
  host=host,
74
+ auto_updates=auto_updates,
72
75
  auto_start=auto_start,
73
76
  open_web_browser=open_web_browser,
74
77
  keep_running=keep_running,
@@ -81,9 +84,11 @@ class Api:
81
84
  interactive=False,
82
85
  auto_updates=None,
83
86
  auto_start=True,
84
- mapped_dir: Path | None = None,
85
- container_name: str | None = None,
87
+ mapped_dir: Path | None = None, # Sketch directory.
88
+ container_name: str | None = None, # Specific docker container name.
89
+ remove_previous: bool = False,
86
90
  ) -> CompileServer:
91
+ """Uses docker to spawn a compile server from the given name."""
87
92
  from fastled.compile_server import CompileServer
88
93
 
89
94
  out = CompileServer(
@@ -92,6 +97,7 @@ class Api:
92
97
  auto_updates=auto_updates,
93
98
  mapped_dir=mapped_dir,
94
99
  auto_start=auto_start,
100
+ remove_previous=remove_previous,
95
101
  )
96
102
  return out
97
103
 
@@ -101,8 +107,9 @@ class Api:
101
107
  interactive=False,
102
108
  auto_updates=None,
103
109
  auto_start=True,
104
- mapped_dir: Path | None = None,
105
- container_name: str | None = None,
110
+ mapped_dir: Path | None = None, # Sketch directory.
111
+ container_name: str | None = None, # Specific docker container name.
112
+ remove_previous=False,
106
113
  ) -> Generator[CompileServer, None, None]:
107
114
  server = Api.spawn_server(
108
115
  interactive=interactive,
@@ -110,6 +117,7 @@ class Api:
110
117
  auto_start=auto_start,
111
118
  mapped_dir=mapped_dir,
112
119
  container_name=container_name,
120
+ remove_previous=remove_previous,
113
121
  )
114
122
  try:
115
123
  yield server
@@ -172,14 +180,37 @@ class Docker:
172
180
  # Create output directory if it doesn't exist
173
181
  output_dir.mkdir(parents=True, exist_ok=True)
174
182
 
183
+ git_dir = output_dir / ".git"
184
+ library_properties = output_dir / "library.properties"
185
+
186
+ git_dir_exists = git_dir.exists()
187
+ library_properties_exists = library_properties.exists()
188
+ library_properties_text = (
189
+ library_properties.read_text().strip() if library_properties_exists else ""
190
+ )
191
+
192
+ already_exists = (
193
+ git_dir_exists
194
+ and library_properties_exists
195
+ and "FastLED" in library_properties_text
196
+ )
197
+ if git_dir_exists and not already_exists:
198
+ if ".cache/fastled" in str(output_dir.as_posix()):
199
+ shutil.rmtree(output_dir)
200
+ already_exists = False
201
+ else:
202
+ raise ValueError(
203
+ f"Output directory {output_dir} already exists but does not appear to be a FastLED repository."
204
+ )
205
+
175
206
  # Clone or update the repository
176
- if (output_dir / ".git").exists():
207
+ if already_exists:
177
208
  print(f"Updating existing repository in {output_dir}")
178
209
  # Reset local changes and move HEAD back to handle force pushes
179
210
  subprocess.run(
180
211
  ["git", "reset", "--hard", "HEAD~10"],
181
212
  cwd=output_dir,
182
- check=True,
213
+ check=False,
183
214
  capture_output=True, # Suppress output of reset
184
215
  )
185
216
  subprocess.run(
@@ -232,12 +263,14 @@ class Docker:
232
263
  remove_previous=True, # Remove any existing container
233
264
  )
234
265
 
235
- return container.name
266
+ return container.name # Todo, create an external docker container api.
236
267
 
237
268
  @staticmethod
238
269
  def build_from_fastled_repo(
239
- project_root: Path | str = Path("."), platform_tag: str = ""
240
- ) -> str:
270
+ project_root: Path | str = Path("."),
271
+ interactive: bool = False,
272
+ sketch_folder: Path | None = None,
273
+ ) -> CompileServer:
241
274
  """Build the FastLED WASM compiler Docker image, which will be tagged as "main".
242
275
 
243
276
  Args:
@@ -250,15 +283,22 @@ class Docker:
250
283
  from fastled.docker_manager import DockerManager
251
284
  from fastled.settings import CONTAINER_NAME, IMAGE_NAME
252
285
 
286
+ project_root = Path(project_root)
287
+ if interactive:
288
+ if sketch_folder is None:
289
+ sketch_folder = project_root / "examples" / "wasm"
290
+ else:
291
+ if sketch_folder is not None:
292
+ raise ValueError(
293
+ "Cannot specify sketch_folder when not in interactive mode."
294
+ )
253
295
  if isinstance(project_root, str):
254
296
  project_root = Path(project_root)
255
297
 
256
298
  dockerfile_path = (
257
299
  project_root / "src" / "platforms" / "wasm" / "compiler" / "Dockerfile"
258
300
  )
259
-
260
301
  docker_mgr = DockerManager()
261
-
262
302
  platform_tag = ""
263
303
  # if "arm" in docker_mgr.architecture():
264
304
  if (
@@ -280,18 +320,16 @@ class Docker:
280
320
  platform_tag=platform_tag,
281
321
  )
282
322
 
283
- # Run the container and return it
284
- container = docker_mgr.run_container_detached(
285
- image_name=IMAGE_NAME,
286
- tag="main",
323
+ out: CompileServer = CompileServer(
287
324
  container_name=CONTAINER_NAME,
288
- command=None, # Use default command from Dockerfile
289
- volumes=None, # No volumes needed for build
290
- ports=None, # No ports needed for build
291
- remove_previous=True, # Remove any existing container
325
+ interactive=interactive,
326
+ auto_updates=False,
327
+ mapped_dir=sketch_folder,
328
+ auto_start=True,
329
+ remove_previous=True,
292
330
  )
293
- container_name = f"{container.name}"
294
- return container_name
331
+
332
+ return out
295
333
 
296
334
 
297
335
  class Tools:
@@ -7,8 +7,9 @@ import sys
7
7
  import time
8
8
  from pathlib import Path
9
9
 
10
- from fastled.client_server import run_client, run_client_server
10
+ from fastled.client_server import run_client_server
11
11
  from fastled.compile_server import CompileServer
12
+ from fastled.filewatcher import file_watcher_set
12
13
  from fastled.parse_args import parse_args
13
14
 
14
15
 
@@ -49,8 +50,10 @@ def main() -> int:
49
50
  update: bool = args.update
50
51
  build: bool = args.build
51
52
  just_compile: bool = args.just_compile
52
- directory: Path | None = Path(args.directory).absolute() if args.directory else None
53
+ # directory: Path | None = Path(args.directory).absolute() if args.directory else None
54
+ directory: Path | None = Path(args.directory) if args.directory else None
53
55
 
56
+ # broken for now
54
57
  if directory is None and interactive:
55
58
  # if examples/wasm exists
56
59
  if Path("examples/wasm").exists():
@@ -66,42 +69,36 @@ def main() -> int:
66
69
 
67
70
  if build:
68
71
  try:
72
+ file_watcher_set(False)
69
73
  project_root = Path(".").absolute()
70
74
  print(f"Building Docker image at {project_root}")
71
75
  from fastled import Api, Docker
72
76
 
73
- docker_image_name = Docker.build_from_fastled_repo(
74
- project_root=project_root
77
+ server = Docker.build_from_fastled_repo(
78
+ project_root=project_root, interactive=interactive
75
79
  )
76
- print(f"Built Docker image: {docker_image_name}")
80
+ assert isinstance(server, CompileServer)
81
+
82
+ if interactive:
83
+ server.stop()
84
+ return 0
85
+ print(f"Built Docker image: {server.name}")
77
86
  if not directory:
78
- print("No sketch directory specified. So exiting...")
87
+ if not directory:
88
+ print("No directory specified")
89
+ server.stop()
79
90
  return 0
91
+
80
92
  print("Running server")
81
- with Api.server(
93
+ with Api.live_client(
82
94
  auto_updates=False,
83
- container_name=docker_image_name,
84
- interactive=interactive,
85
- mapped_dir=directory,
86
- ) as server:
87
- sketch_dir = Path("examples/wasm")
88
- if just_compile:
89
- rtn = run_client(
90
- directory=sketch_dir,
91
- host=server,
92
- open_web_browser=False,
93
- keep_running=False,
94
- )
95
- if rtn != 0:
96
- print(f"Failed to compile: {rtn})")
97
- return rtn
98
- print(f"Server started at {server.url()}")
99
- with Api.live_client(
100
- sketch_directory=sketch_dir, host=server
101
- ) as client:
102
- print(f"Client started at {client.url()}")
103
- while True:
104
- time.sleep(0.1)
95
+ sketch_directory=directory,
96
+ host=server,
97
+ auto_start=True,
98
+ keep_running=not just_compile,
99
+ ) as client:
100
+ print(f"Exited client {client.url()}")
101
+ print(f"Exiting {server.name}")
105
102
  except KeyboardInterrupt:
106
103
  print("\nExiting from client...")
107
104
  return 1
@@ -118,7 +115,8 @@ if __name__ == "__main__":
118
115
  # Note that the entry point for the exe is in cli.py
119
116
  try:
120
117
  sys.argv.append("-b")
121
- sys.argv.append("-i")
118
+ sys.argv.append("examples/wasm")
119
+ # sys.argv.append()
122
120
  import os
123
121
 
124
122
  os.chdir("../fastled")
@@ -14,6 +14,7 @@ class CompileServer:
14
14
  auto_start: bool = True,
15
15
  container_name: str | None = None,
16
16
  platform: Platform = Platform.WASM,
17
+ remove_previous: bool = False,
17
18
  ) -> None:
18
19
  from fastled.compile_server_impl import ( # avoid circular import
19
20
  CompileServerImpl,
@@ -27,6 +28,7 @@ class CompileServer:
27
28
  auto_updates=auto_updates,
28
29
  mapped_dir=mapped_dir,
29
30
  auto_start=auto_start,
31
+ remove_previous=remove_previous,
30
32
  )
31
33
 
32
34
  # May throw CompileServerError if server could not be started.
@@ -51,6 +53,10 @@ class CompileServer:
51
53
 
52
54
  project_init(example=example, outputdir=outputdir)
53
55
 
56
+ @property
57
+ def name(self) -> str:
58
+ return self.impl.container_name
59
+
54
60
  @property
55
61
  def running(self) -> bool:
56
62
  return self.impl.running
@@ -42,6 +42,7 @@ class CompileServerImpl:
42
42
  mapped_dir: Path | None = None,
43
43
  auto_start: bool = True,
44
44
  container_name: str | None = None,
45
+ remove_previous: bool = False,
45
46
  ) -> None:
46
47
  container_name = container_name or DEFAULT_CONTAINER_NAME
47
48
  if interactive and not mapped_dir:
@@ -49,7 +50,9 @@ class CompileServerImpl:
49
50
  "Interactive mode requires a mapped directory point to a sketch"
50
51
  )
51
52
  if not interactive and mapped_dir:
52
- raise ValueError("Mapped directory is only used in interactive mode")
53
+ warnings.warn(
54
+ f"Mapped directory {mapped_dir} is ignored in non-interactive mode"
55
+ )
53
56
  self.container_name = container_name
54
57
  self.mapped_dir = mapped_dir
55
58
  self.docker = DockerManager()
@@ -57,6 +60,7 @@ class CompileServerImpl:
57
60
  self.interactive = interactive
58
61
  self.running_container: RunningContainer | None = None
59
62
  self.auto_updates = auto_updates
63
+ self.remove_previous = remove_previous
60
64
  self._port = 0 # 0 until compile server is started
61
65
  if auto_start:
62
66
  self.start()
@@ -242,7 +246,7 @@ class CompileServerImpl:
242
246
  command=cmd_str,
243
247
  ports=ports,
244
248
  volumes=volumes,
245
- remove_previous=self.interactive,
249
+ remove_previous=self.interactive or self.remove_previous,
246
250
  )
247
251
  self.running_container = self.docker.attach_and_run(container)
248
252
  assert self.running_container is not None, "Container should be running"
@@ -16,6 +16,16 @@ from watchdog.observers import Observer
16
16
  from watchdog.observers.api import BaseObserver
17
17
 
18
18
 
19
+ def file_watcher_enabled() -> bool:
20
+ """Check if watchdog is disabled"""
21
+ return os.getenv("NO_FILE_WATCHING", "0") == "1"
22
+
23
+
24
+ def file_watcher_set(enabled: bool) -> None:
25
+ """Set the file watcher enabled state"""
26
+ os.environ["NO_FILE_WATCHING"] = "1" if not enabled else "0"
27
+
28
+
19
29
  class MyEventHandler(FileSystemEventHandler):
20
30
  def __init__(
21
31
  self,
@@ -119,6 +129,9 @@ class FileChangedNotifier(threading.Thread):
119
129
  Returns:
120
130
  Changed filepath or None if no change within timeout
121
131
  """
132
+ if file_watcher_enabled():
133
+ time.sleep(timeout)
134
+ return None
122
135
  try:
123
136
  filepath = self.change_queue.get(timeout=timeout)
124
137
  current_time = time.time()
@@ -1,4 +1,5 @@
1
1
  import threading
2
+ import warnings
2
3
  from pathlib import Path
3
4
 
4
5
  from fastled.compile_server import CompileServer
@@ -13,6 +14,7 @@ class LiveClient:
13
14
  sketch_directory: Path,
14
15
  host: str | CompileServer | None = None,
15
16
  auto_start: bool = True,
17
+ auto_updates: bool = True,
16
18
  open_web_browser: bool = True,
17
19
  keep_running: bool = True,
18
20
  build_mode: BuildMode = BuildMode.QUICK,
@@ -27,8 +29,11 @@ class LiveClient:
27
29
  self.auto_start = auto_start
28
30
  self.shutdown = threading.Event()
29
31
  self.thread: threading.Thread | None = None
32
+ self.auto_updates = auto_updates
30
33
  if auto_start:
31
34
  self.start()
35
+ if self.auto_updates is False:
36
+ warnings.warn("Auto updates False are not supported yet.")
32
37
 
33
38
  def run(self) -> int:
34
39
  """Run the client."""
@@ -32,6 +32,7 @@ def test_examples(
32
32
  print(f"Compilation took: {diff:.2f} seconds")
33
33
  result = Api.web_compile(sketch_dir, host=host)
34
34
  if not result.success:
35
+ print(f"Compilation failed for {example}: {result.stdout}")
35
36
  out[example] = Exception(result.stdout)
36
37
  return out
37
38
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fastled
3
- Version: 1.2.30
3
+ Version: 1.2.32
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -295,6 +295,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
295
295
 
296
296
  # Revisions
297
297
 
298
+ * 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
298
299
  * 1.2.22 - Prefer to use `live-server` from npm. If npm exists on the system then do a background install of `live-server` for next run.
299
300
  * 1.2.20 - Fixed up path issue for web browser launch for hot reload.
300
301
  * 1.2.19 - Compilation failure now overwrites the index.html file with error message.
@@ -65,6 +65,8 @@ tests/test_api.py
65
65
  tests/test_bad_ino.py
66
66
  tests/test_build.py
67
67
  tests/test_build_examples.py
68
+ tests/test_build_from_docker.py
69
+ tests/test_build_from_github.py
68
70
  tests/test_cli.py
69
71
  tests/test_compile_server.py
70
72
  tests/test_docker_linux_on_windows.py
@@ -35,11 +35,11 @@ class BuildDockerFromRepoTester(unittest.TestCase):
35
35
  def test_build_docker(self) -> None:
36
36
  """Builds the docker file from the fastled repo."""
37
37
 
38
- docker_image_name = Docker.build_from_fastled_repo(FASTLED_SISTER_REPO)
39
- self.assertTrue(docker_image_name, "Failed to build docker image")
40
- server: CompileServer
41
- with Api.server(auto_updates=True, container_name=docker_image_name) as server:
42
- self.assertTrue(server.ping())
38
+ container = Docker.build_from_fastled_repo(FASTLED_SISTER_REPO)
39
+ try:
40
+ self.assertTrue(container.ping())
41
+ finally:
42
+ container.stop()
43
43
 
44
44
  @unittest.skipUnless(_enabled(), "Skipping test on non-Linux system on github")
45
45
  def test_build_docker_from_github(self) -> None:
@@ -0,0 +1,47 @@
1
+ """
2
+ Unit test file.
3
+ """
4
+
5
+ import unittest
6
+ from pathlib import Path
7
+
8
+ from fastled import CompileServer, Docker, Test
9
+
10
+ HERE = Path(__file__).parent
11
+ PROJECT_ROOT = HERE.parent
12
+ FASTLED_SISTER_REPO = PROJECT_ROOT / ".." / "FastLED"
13
+
14
+ DEFAULT_GITHUB_URL = "https://github.com/fastled/fastled"
15
+ OUTPUT_DIR = Path(".cache/fastled")
16
+
17
+
18
+ def _enabled() -> bool:
19
+ """Check if this system can run the tests."""
20
+ sister_repo_does_not_exist = not FASTLED_SISTER_REPO.exists()
21
+
22
+ if sister_repo_does_not_exist:
23
+ print(
24
+ f"This test is only enable when FastLED is a repo in the same directly as the project root folder: {FASTLED_SISTER_REPO} does not exist"
25
+ )
26
+ return False
27
+
28
+ return Test.can_run_local_docker_tests()
29
+
30
+
31
+ class BuildDockerFromRepoTester(unittest.TestCase):
32
+ """Main tester class."""
33
+
34
+ @unittest.skipUnless(_enabled(), "Skipping test on non-Linux system on github")
35
+ def test_build_docker(self) -> None:
36
+ """Builds the docker file from the fastled repo."""
37
+ server: CompileServer = Docker.build_from_fastled_repo(FASTLED_SISTER_REPO)
38
+ self.assertIsNotNone(server, "Failed to build docker image")
39
+
40
+ try:
41
+ self.assertTrue(server.ping())
42
+ finally:
43
+ server.stop()
44
+
45
+
46
+ if __name__ == "__main__":
47
+ unittest.main()
@@ -0,0 +1,46 @@
1
+ """
2
+ Unit test file.
3
+ """
4
+
5
+ import unittest
6
+ from pathlib import Path
7
+
8
+ from fastled import Api, CompileServer, Docker, Test # type: ignore
9
+
10
+ HERE = Path(__file__).parent
11
+ PROJECT_ROOT = HERE.parent
12
+ FASTLED_SISTER_REPO = PROJECT_ROOT / ".." / "FastLED"
13
+
14
+ DEFAULT_GITHUB_URL = "https://github.com/fastled/fastled"
15
+ OUTPUT_DIR = Path(".cache/fastled")
16
+
17
+
18
+ def _enabled() -> bool:
19
+ """Check if this system can run the tests."""
20
+ sister_repo_does_not_exist = not FASTLED_SISTER_REPO.exists()
21
+
22
+ if sister_repo_does_not_exist:
23
+ print(
24
+ f"This test is only enable when FastLED is a repo in the same directly as the project root folder: {FASTLED_SISTER_REPO} does not exist"
25
+ )
26
+ return False
27
+
28
+ return Test.can_run_local_docker_tests()
29
+
30
+
31
+ class BuildDockerFromGithubTester(unittest.TestCase):
32
+
33
+ @unittest.skipUnless(_enabled(), "Skipping test on non-Linux system on github")
34
+ def test_build_docker_from_github(self) -> None:
35
+ """Builds the docker file from the fastled repo."""
36
+ url = DEFAULT_GITHUB_URL
37
+ print("Building from github")
38
+ docker_image_name = Docker.build_from_github(url=url, output_dir=OUTPUT_DIR)
39
+ self.assertTrue(docker_image_name, "Failed to build docker image")
40
+ server: CompileServer
41
+ with Api.server(auto_updates=True, container_name=docker_image_name) as server:
42
+ self.assertTrue(server.ping())
43
+
44
+
45
+ if __name__ == "__main__":
46
+ unittest.main()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes