fastled 1.3.6__py3-none-any.whl → 1.3.11__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.3.6"
4
+ __version__ = "1.3.11"
5
5
 
6
6
  __version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
fastled/app.py CHANGED
@@ -2,6 +2,7 @@
2
2
  Uses the latest wasm compiler image to compile the FastLED sketch.
3
3
  """
4
4
 
5
+ import os
5
6
  import sys
6
7
  import time
7
8
  from pathlib import Path
@@ -31,6 +32,7 @@ def run_server(args: Args) -> int:
31
32
  auto_updates=auto_update,
32
33
  mapped_dir=mapped_dir,
33
34
  auto_start=True,
35
+ remove_previous=args.clear,
34
36
  )
35
37
 
36
38
  if not interactive:
@@ -112,7 +114,7 @@ def main() -> int:
112
114
  auto_updates=False,
113
115
  mapped_dir=directory,
114
116
  auto_start=False,
115
- remove_previous=False,
117
+ remove_previous=args.clear,
116
118
  )
117
119
 
118
120
  server.start(wait_for_startup=False)
fastled/args.py CHANGED
@@ -22,6 +22,7 @@ class Args:
22
22
  quick: bool
23
23
  release: bool
24
24
  ram_disk_size: str # suffixed liked "25mb" or "1gb"
25
+ clear = False # Force the last running container to be removed. Useful for benchmarking.
25
26
 
26
27
  @staticmethod
27
28
  def from_namespace(args: argparse.Namespace) -> "Args":
@@ -61,6 +62,7 @@ class Args:
61
62
  assert isinstance(
62
63
  args.release, bool
63
64
  ), f"expected bool, got {type(args.release)}"
65
+
64
66
  init: bool | str = False
65
67
  if args.init is None:
66
68
  init = False
fastled/cli.py CHANGED
@@ -3,7 +3,6 @@ Main entry point.
3
3
  """
4
4
 
5
5
  import multiprocessing
6
- import os
7
6
  import sys
8
7
 
9
8
 
@@ -16,9 +15,9 @@ def run_app() -> int:
16
15
 
17
16
  def main() -> int:
18
17
  """Main entry point for the template_python_cmd package."""
19
- if "--debug" in sys.argv:
20
- # Debug mode
21
- os.environ["FLASK_SERVER_LOGGING"] = "1"
18
+ # if "--debug" in sys.argv:
19
+ # # Debug mode
20
+ # os.environ["FLASK_SERVER_LOGGING"] = "1"
22
21
  return run_app()
23
22
 
24
23
 
fastled/client_server.py CHANGED
@@ -129,7 +129,7 @@ def _run_web_compiler(
129
129
 
130
130
 
131
131
  def _try_start_server_or_get_url(
132
- auto_update: bool, args_web: str | bool, localhost: bool
132
+ auto_update: bool, args_web: str | bool, localhost: bool, clear: bool
133
133
  ) -> tuple[str, CompileServer | None]:
134
134
  is_local_host = localhost or (
135
135
  isinstance(args_web, str)
@@ -159,7 +159,9 @@ def _try_start_server_or_get_url(
159
159
  else:
160
160
  try:
161
161
  print("No local server found, starting one...")
162
- compile_server = CompileServer(auto_updates=auto_update)
162
+ compile_server = CompileServer(
163
+ auto_updates=auto_update, remove_previous=clear
164
+ )
163
165
  print("Waiting for the local compiler to start...")
164
166
  if not compile_server.ping():
165
167
  print("Failed to start local compiler.")
@@ -172,7 +174,7 @@ def _try_start_server_or_get_url(
172
174
  return (DEFAULT_URL, None)
173
175
 
174
176
 
175
- def _try_make_compile_server() -> CompileServer | None:
177
+ def _try_make_compile_server(clear: bool = False) -> CompileServer | None:
176
178
  if not DockerManager.is_docker_installed():
177
179
  return None
178
180
  try:
@@ -184,7 +186,7 @@ def _try_make_compile_server() -> CompileServer | None:
184
186
  free_port = find_free_port(start_port=9723, end_port=9743)
185
187
  if free_port is None:
186
188
  return None
187
- compile_server = CompileServer(auto_updates=False)
189
+ compile_server = CompileServer(auto_updates=False, remove_previous=clear)
188
190
  print("Waiting for the local compiler to start...")
189
191
  if not compile_server.ping():
190
192
  print("Failed to start local compiler.")
@@ -222,13 +224,14 @@ def run_client(
222
224
  http_port: (
223
225
  int | None
224
226
  ) = None, # None means auto select a free port, http_port < 0 means no server.
227
+ clear: bool = False,
225
228
  ) -> int:
226
229
  has_checked_newer_version_yet = False
227
230
  compile_server: CompileServer | None = None
228
231
 
229
232
  if host is None:
230
233
  # attempt to start a compile server if docker is installed.
231
- compile_server = _try_make_compile_server()
234
+ compile_server = _try_make_compile_server(clear=clear)
232
235
  if compile_server is None:
233
236
  host = DEFAULT_URL
234
237
  elif isinstance(host, CompileServer):
@@ -485,7 +488,9 @@ def run_client_server(args: Args) -> int:
485
488
  url: str
486
489
  compile_server: CompileServer | None = None
487
490
  try:
488
- url, compile_server = _try_start_server_or_get_url(auto_update, web, localhost)
491
+ url, compile_server = _try_start_server_or_get_url(
492
+ auto_update, web, localhost, args.clear
493
+ )
489
494
  except KeyboardInterrupt:
490
495
  print("\nExiting from first try...")
491
496
  if compile_server is not None:
@@ -505,6 +510,7 @@ def run_client_server(args: Args) -> int:
505
510
  keep_running=not just_compile,
506
511
  build_mode=build_mode,
507
512
  profile=profile,
513
+ clear=args.clear,
508
514
  )
509
515
  except KeyboardInterrupt:
510
516
  return 1
fastled/docker_manager.py CHANGED
@@ -36,6 +36,9 @@ _IS_GITHUB = "GITHUB_ACTIONS" in os.environ
36
36
  _DEFAULT_BUILD_DIR = "/js/.pio/build"
37
37
 
38
38
 
39
+ FORCE_CLEAR: bool = bool(os.environ.get("FASTLED_FORCE_CLEAR", "0") == "1")
40
+
41
+
39
42
  # Docker uses datetimes in UTC but without the timezone info. If we pass in a tz
40
43
  # then it will throw an exception.
41
44
  def _utc_now_no_tz() -> datetime:
@@ -65,6 +68,15 @@ def get_ramdisk_size() -> str | None:
65
68
  return None # Defaults to off
66
69
 
67
70
 
71
+ def get_force_remove_image_previous() -> bool:
72
+ """Get the force remove image previous value."""
73
+ return os.environ.get("FASTLED_FORCE_CLEAR", "0") == "1"
74
+
75
+
76
+ def set_clear() -> None:
77
+ os.environ["FASTLED_FORCE_CLEAR"] = "1"
78
+
79
+
68
80
  def _win32_docker_location() -> str | None:
69
81
  home_dir = Path.home()
70
82
  out = [
@@ -211,6 +223,18 @@ def _hack_to_fix_mac(volumes: list[Volume] | None) -> list[Volume] | None:
211
223
  return volumes
212
224
 
213
225
 
226
+ def set_force_remove_image_previous(new_value: str | None = None) -> None:
227
+ if new_value is not None:
228
+ os.environ["FASTLED_FORCE_CLEAR"] = new_value
229
+ else:
230
+ os.environ["FASTLED_FORCE_CLEAR"] == "1"
231
+
232
+
233
+ def force_image_removal() -> bool:
234
+ """Get the force remove image previous value."""
235
+ return os.environ.get("FASTLED_FORCE_CLEAR", "0") == "1"
236
+
237
+
214
238
  class DockerManager:
215
239
  def __init__(self) -> None:
216
240
  from docker.errors import DockerException
@@ -628,6 +652,13 @@ class DockerManager:
628
652
  ports: Dict mapping host ports to container ports
629
653
  Example: {8080: 80} maps host port 8080 to container port 80
630
654
  """
655
+ remove_previous = remove_previous or get_force_remove_image_previous()
656
+ if remove_previous:
657
+ # make a banner print
658
+ print(
659
+ "Force removing previous image due to FASTLED_FORCE_CLEAR environment variable."
660
+ )
661
+
631
662
  tmpfs_size = tmpfs_size or get_ramdisk_size()
632
663
  sys_admin = tmpfs_size is not None and tmpfs_size != "0"
633
664
  volumes = _hack_to_fix_mac(volumes)
fastled/parse_args.py CHANGED
@@ -146,6 +146,12 @@ def parse_args() -> Args:
146
146
  help="Remove all FastLED containers and images",
147
147
  )
148
148
 
149
+ parser.add_argument(
150
+ "--clear",
151
+ action="store_true",
152
+ help="Remove all FastLED containers and images",
153
+ )
154
+
149
155
  build_mode = parser.add_mutually_exclusive_group()
150
156
  build_mode.add_argument("--debug", action="store_true", help="Build in debug mode")
151
157
  build_mode.add_argument(
@@ -162,13 +168,24 @@ def parse_args() -> Args:
162
168
 
163
169
  args = parser.parse_args()
164
170
 
165
- if args.ram_disk_size != "0":
166
- from fastled.docker_manager import set_ramdisk_size
167
- from fastled.util import banner_string
171
+ # TODO: propagate the library.
172
+ # from fastled.docker_manager import force_remove_previous
168
173
 
169
- msg = banner_string(f"Setting tmpfs size to {args.ram_disk_size}")
170
- print(msg)
171
- set_ramdisk_size(args.ram_disk_size)
174
+ # if force_remove_previous():
175
+ # print("Removing previous containers...")
176
+ # do itinfront he camer
177
+ # nonw invoke via the
178
+ #
179
+ # Work in progress.
180
+ # set_ramdisk_size("50mb")
181
+
182
+ # if args.ram_disk_size != "0":
183
+ # from fastled.docker_manager import set_ramdisk_size
184
+ # from fastled.util import banner_string
185
+
186
+ # msg = banner_string(f"Setting tmpfs size to {args.ram_disk_size}")
187
+ # print(msg)
188
+ # set_ramdisk_size(args.ram_disk_size)
172
189
 
173
190
  if args.purge:
174
191
  from fastled.docker_manager import DockerManager
@@ -188,15 +205,23 @@ def parse_args() -> Args:
188
205
  print(f"Use 'fastled {args.directory}' to compile the project.")
189
206
  sys.exit(0)
190
207
 
208
+ cwd: Path = Path(os.getcwd())
209
+ fastled_dir: Path | None = _find_fastled_repo(cwd)
210
+ is_fastled_dir: bool = fastled_dir is not None
211
+
212
+ if is_fastled_dir:
213
+ # if --quick, --debug, --release are not specified then default to --debug
214
+ if not (args.debug or args.quick or args.release):
215
+ args.debug = True
216
+ print("Defaulting to --debug mode")
217
+
191
218
  if args.build or args.interactive:
192
- cwd: Path = Path(os.getcwd())
193
- fastled_dir: Path | None = _find_fastled_repo(cwd)
194
219
  if args.directory is not None:
195
220
  args.directory = str(Path(args.directory).absolute())
196
- if fastled_dir is None:
221
+ if not is_fastled_dir:
197
222
  print("This command must be run from within the FastLED repo. Exiting...")
198
223
  sys.exit(1)
199
- if cwd != fastled_dir:
224
+ if cwd != fastled_dir and fastled_dir is not None:
200
225
  print(f"Switching to FastLED repo at {fastled_dir}")
201
226
  os.chdir(fastled_dir)
202
227
  if args.directory is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.3.6
3
+ Version: 1.3.11
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -1,20 +1,20 @@
1
1
  fastled/__init__.py,sha256=YLikXGRWKlKAqj7bpvGmJLejGTFF-FC1lv2z1jwRinA,6852
2
- fastled/__version__.py,sha256=7a4fREDgqwqn8rf_S0Gr_RG5Ws6Mlha1HODKaTjPHU8,372
3
- fastled/app.py,sha256=1N5Q486YccaWCRqnaI2F04ktL64NAVjAN6i4c-zgm1o,5818
4
- fastled/args.py,sha256=E-CElEDTqRrI0wDyu-nt9Rj0FiTG6y-Xq_w91Dt0J_g,3186
5
- fastled/cli.py,sha256=5EBsb02ueFUjlgrlg0GMdj3e5nnHVhvofmYyQRaw8uM,565
2
+ fastled/__version__.py,sha256=KmmoedZhGt1dbJf1JiJmTN7nqvZDgK3S5V6UR0CU8hM,373
3
+ fastled/app.py,sha256=I8Kxbm6vpN5WxHIhesoSkZtNNho5aHqUDGTaesu8hcM,5869
4
+ fastled/args.py,sha256=d9CaarQ1yw7w0REwgrNQ78zOUQSk94fTXwXHtFZPTSY,3281
5
+ fastled/cli.py,sha256=drgR2AOxVrj3QEz58iiKscYAumbbin2vIV-k91VCOAA,561
6
6
  fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
7
7
  fastled/cli_test_interactive.py,sha256=BjNhveZOk5aCffHbcrxPQQjWmAuj4ClVKKcKX5eY6yM,542
8
- fastled/client_server.py,sha256=falqUhGSHQpNfEXNCcQFPDAZymfncEVhIDcURBIJTFk,18390
8
+ fastled/client_server.py,sha256=uK-reqTN4umtVm8K3fcLo2Op_P_jFKVFtKFJRpBF1Xs,18598
9
9
  fastled/compile_server.py,sha256=rkXvrvdav5vDG8lv_OlBX3YSCHtnHMt25nXbfeg_r78,2960
10
10
  fastled/compile_server_impl.py,sha256=MIe-GvKenoDaqX8VhCJ7KNIWTOHHcLPgUQ7kO6lsa38,12199
11
- fastled/docker_manager.py,sha256=OWAWfKrtJQU6joXZF9bnoLmh8T8U3dGq-obqBuNVY_8,39260
11
+ fastled/docker_manager.py,sha256=18m6lc54leN5Pjj9wropP-CJ5KAa25WIS5_koFZB7Ng,40215
12
12
  fastled/filewatcher.py,sha256=3qS3L7zMQhFuVrkeGn1djsB_cB6x_E2YGJmmQWVAU_w,10033
13
13
  fastled/keyboard.py,sha256=UTAsqCn1UMYnB8YDzENiLTj4GeL45tYfEcO7_5fLFEg,3556
14
14
  fastled/keyz.py,sha256=LO-8m_7CpNDiZLM-FXhQ30f9gN1bUYz5lOsUPTIbI-c,4020
15
15
  fastled/live_client.py,sha256=yoAul8tVgbbPf1oEC79SUZSHkLECxlrXxgWR9XaBIp4,2957
16
16
  fastled/open_browser.py,sha256=DFyMrc1qic4Go7eLNPqMaLuMvTaE73NixdfSKV0yyp8,3709
17
- fastled/parse_args.py,sha256=EnJa0FZi8RPtIzldK-CJRJvQhl83rCzz-oQrIDok2e8,9937
17
+ fastled/parse_args.py,sha256=z2UO5DxTr7wnsT6-QTF26lrBM60_kTz7t-bxbcP4bm0,10701
18
18
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
19
19
  fastled/print_filter.py,sha256=oomBjrouWNPCgJY2guCpljTijFvNKRBVbipDrxIsszA,7426
20
20
  fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
@@ -36,9 +36,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
36
36
  fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
37
37
  fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
38
38
  fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
39
- fastled-1.3.6.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
40
- fastled-1.3.6.dist-info/METADATA,sha256=ovogtrnJaVuIEeBvSWcCwu2-T8X0MsyWDN-96Prpvf0,30049
41
- fastled-1.3.6.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
42
- fastled-1.3.6.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
43
- fastled-1.3.6.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
44
- fastled-1.3.6.dist-info/RECORD,,
39
+ fastled-1.3.11.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
40
+ fastled-1.3.11.dist-info/METADATA,sha256=ZcoMV7PUI60nsg9Z4KnBeTwJcfA0hDvRhSGDtSy3_58,30050
41
+ fastled-1.3.11.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
42
+ fastled-1.3.11.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
43
+ fastled-1.3.11.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
44
+ fastled-1.3.11.dist-info/RECORD,,