fastled 1.2.41__py3-none-any.whl → 1.2.42__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,16 +1,10 @@
1
1
  """FastLED Wasm Compiler package."""
2
2
 
3
- # context
4
- import shutil
5
- import subprocess
6
- import tempfile
7
3
  from contextlib import contextmanager
8
4
  from multiprocessing import Process
9
5
  from pathlib import Path
10
6
  from typing import Generator
11
7
 
12
- import httpx
13
-
14
8
  from .compile_server import CompileServer
15
9
  from .live_client import LiveClient
16
10
  from .site.build import build
@@ -19,7 +13,7 @@ from .types import BuildMode, CompileResult, CompileServerError
19
13
  # IMPORTANT! There's a bug in github which will REJECT any version update
20
14
  # that has any other change in the repo. Please bump the version as the
21
15
  # ONLY change in a commit, or else the pypi update and the release will fail.
22
- __version__ = "1.2.41"
16
+ __version__ = "1.2.42"
23
17
 
24
18
  DOCKER_FILE = (
25
19
  "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
@@ -163,204 +157,6 @@ class Docker:
163
157
  docker_mgr = DockerManager()
164
158
  docker_mgr.purge(image_name=IMAGE_NAME)
165
159
 
166
- @staticmethod
167
- def spawn_server_from_github(
168
- url: str = "https://github.com/fastled/fastled",
169
- output_dir: Path | str = Path(".cache/fastled"),
170
- ) -> CompileServer:
171
- """Build the FastLED WASM compiler Docker image from a GitHub repository.
172
-
173
- Args:
174
- url: GitHub repository URL (default: https://github.com/fastled/fastled)
175
- output_dir: Directory to clone the repo into (default: .cache/fastled)
176
-
177
- Returns:
178
- Container name.
179
- """
180
-
181
- from fastled.docker_manager import DockerManager
182
- from fastled.settings import CONTAINER_NAME, IMAGE_NAME
183
-
184
- if isinstance(output_dir, str):
185
- output_dir = Path(output_dir)
186
-
187
- # Create output directory if it doesn't exist
188
- output_dir.mkdir(parents=True, exist_ok=True)
189
-
190
- git_dir = output_dir / ".git"
191
- library_properties = output_dir / "library.properties"
192
-
193
- git_dir_exists = git_dir.exists()
194
- library_properties_exists = library_properties.exists()
195
- library_properties_text = (
196
- library_properties.read_text().strip() if library_properties_exists else ""
197
- )
198
-
199
- already_exists = (
200
- git_dir_exists
201
- and library_properties_exists
202
- and "FastLED" in library_properties_text
203
- )
204
- if git_dir_exists and not already_exists:
205
- if ".cache/fastled" in str(output_dir.as_posix()):
206
- shutil.rmtree(output_dir)
207
- already_exists = False
208
- else:
209
- raise ValueError(
210
- f"Output directory {output_dir} already exists but does not appear to be a FastLED repository."
211
- )
212
-
213
- # Clone or update the repository
214
- if already_exists:
215
- print(f"Updating existing repository in {output_dir}")
216
- # Reset local changes and move HEAD back to handle force pushes
217
- subprocess.run(
218
- ["git", "reset", "--hard", "HEAD~10"],
219
- cwd=output_dir,
220
- check=False,
221
- capture_output=True, # Suppress output of reset
222
- )
223
- subprocess.run(
224
- ["git", "pull", "origin", "master"], cwd=output_dir, check=True
225
- )
226
- else:
227
- print(f"Cloning {url} into {output_dir}")
228
- subprocess.run(
229
- ["git", "clone", "--depth", "1", url, str(output_dir)], check=True
230
- )
231
-
232
- with tempfile.TemporaryDirectory() as tempdir:
233
- dockerfiles_dst = Path(tempdir) / "Dockerfile"
234
- # download the file and write it to dockerfiles_dst path
235
- with open(dockerfiles_dst, "wb") as f:
236
- with httpx.stream("GET", DOCKER_FILE) as response:
237
- for chunk in response.iter_bytes():
238
- f.write(chunk)
239
-
240
- if not dockerfiles_dst.exists():
241
- raise FileNotFoundError(
242
- f"Dockerfile not found at {dockerfiles_dst}. "
243
- "This may not be a valid FastLED repository."
244
- )
245
-
246
- docker_mgr = DockerManager()
247
-
248
- platform_tag = ""
249
- # if "arm" in docker_mgr.architecture():
250
- if (
251
- "arm"
252
- in subprocess.run(["uname", "-m"], capture_output=True).stdout.decode()
253
- ):
254
- platform_tag = "-arm64"
255
-
256
- # Build the image
257
- docker_mgr.build_image(
258
- image_name=IMAGE_NAME,
259
- tag="main",
260
- dockerfile_path=dockerfiles_dst,
261
- build_context=output_dir,
262
- build_args={"NO_PREWARM": "1"},
263
- platform_tag=platform_tag,
264
- )
265
-
266
- # # Run the container and return it
267
- # container = docker_mgr.run_container_detached(
268
- # image_name=IMAGE_NAME,
269
- # tag="main",
270
- # container_name=CONTAINER_NAME,
271
- # command=None, # Use default command from Dockerfile
272
- # volumes=None, # No volumes needed for build
273
- # ports=None, # No ports needed for build
274
- # remove_previous=True, # Remove any existing container
275
- # )
276
- # name = container.name
277
- # container.stop()
278
-
279
- out: CompileServer = CompileServer(
280
- container_name=CONTAINER_NAME,
281
- interactive=False,
282
- auto_updates=False,
283
- mapped_dir=None,
284
- auto_start=True,
285
- remove_previous=True,
286
- )
287
-
288
- return out
289
-
290
- @staticmethod
291
- def spawn_server_from_fastled_repo(
292
- project_root: Path | str = Path("."),
293
- interactive: bool = False,
294
- sketch_folder: Path | None = None,
295
- ) -> CompileServer:
296
- """Build the FastLED WASM compiler Docker image, which will be tagged as "main".
297
-
298
- Args:
299
- project_root: Path to the FastLED project root directory
300
- platform_tag: Optional platform tag (e.g. "-arm64" for ARM builds)
301
-
302
- Returns:
303
- The string name of the docker container.
304
- """
305
- from fastled.docker_manager import DockerManager
306
- from fastled.settings import CONTAINER_NAME, IMAGE_NAME
307
-
308
- project_root = Path(project_root)
309
- if interactive:
310
- if sketch_folder is None:
311
- sketch_folder = project_root / "examples" / "wasm"
312
-
313
- if isinstance(project_root, str):
314
- project_root = Path(project_root)
315
-
316
- if DockerManager.is_docker_installed() is False:
317
- raise Exception("Docker is not installed.")
318
-
319
- docker_mgr = DockerManager()
320
- if DockerManager.is_running() is False:
321
- docker_mgr.start()
322
-
323
- platform_tag = ""
324
- # if "arm" in docker_mgr.architecture():
325
- if (
326
- "arm"
327
- in subprocess.run(["uname", "-m"], capture_output=True).stdout.decode()
328
- ):
329
- platform_tag = "-arm64"
330
-
331
- # if image exists, remove it
332
- docker_mgr.purge(image_name=IMAGE_NAME)
333
-
334
- with tempfile.TemporaryDirectory() as tempdir:
335
- dockerfile_dst = Path(tempdir) / "Dockerfile"
336
-
337
- # download the file and write it to dockerfiles_dst path
338
- with open(dockerfile_dst, "wb") as f:
339
- with httpx.stream("GET", DOCKER_FILE) as response:
340
- for chunk in response.iter_bytes():
341
- f.write(chunk)
342
-
343
- # Build the image
344
- docker_mgr.build_image(
345
- image_name=IMAGE_NAME,
346
- tag="main",
347
- dockerfile_path=dockerfile_dst,
348
- build_context=project_root,
349
- build_args={"NO_PREWARM": "1"},
350
- platform_tag=platform_tag,
351
- )
352
-
353
- out: CompileServer = CompileServer(
354
- container_name=CONTAINER_NAME,
355
- interactive=interactive,
356
- auto_updates=False,
357
- mapped_dir=sketch_folder,
358
- auto_start=True,
359
- remove_previous=True,
360
- )
361
-
362
- return out
363
-
364
160
 
365
161
  class Tools:
366
162
  @staticmethod
fastled/app.py CHANGED
@@ -60,6 +60,11 @@ def main() -> int:
60
60
  return 0
61
61
 
62
62
  if build:
63
+ print("Building is disabled")
64
+ build = False
65
+
66
+ if build:
67
+ raise NotImplementedError("Building is not yet supported.")
63
68
  file_watcher_set(False)
64
69
  project_root = Path(".").absolute()
65
70
  print(f"Building Docker image at {project_root}")
@@ -110,6 +115,7 @@ def main() -> int:
110
115
  if __name__ == "__main__":
111
116
  # Note that the entry point for the exe is in cli.py
112
117
  try:
118
+ sys.argv.append("-i")
113
119
  sys.argv.append("-b")
114
120
  # sys.argv.append("examples/wasm")
115
121
  # sys.argv.append()
fastled/parse_args.py CHANGED
@@ -155,6 +155,10 @@ def parse_args() -> Args:
155
155
  os.chdir(fastled_dir)
156
156
  if args.directory is None:
157
157
  args.directory = str(Path("examples/wasm").absolute())
158
+ if args.interactive:
159
+ if not args.build:
160
+ print("Adding --build flag when using --interactive")
161
+ args.build = True
158
162
  return Args.from_namespace(args)
159
163
 
160
164
  if not args.update:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fastled
3
- Version: 1.2.41
3
+ Version: 1.2.42
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -1,5 +1,5 @@
1
- fastled/__init__.py,sha256=3zpR2cQiWURhu56q_8wGqNj_kL_m7fORfnc3T4x-JHk,13851
2
- fastled/app.py,sha256=6EE7mRcKKFm1wTyvpk3zy6OtlbHovSlDGU8bSq-Pjws,3763
1
+ fastled/__init__.py,sha256=YrgAlORo0ezAxMNx3mGJa71YPAU04zTxhFX9yOShiow,6747
2
+ fastled/app.py,sha256=AidwEoWyQCrOyz30HvhtqESDo1uze23VmtTr-UHWZJc,3936
3
3
  fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
4
4
  fastled/client_server.py,sha256=Q_-ALIbp474gY1zkYHoaU36eVSIa87nRcSB6IZOoaCg,14315
5
5
  fastled/compile_server.py,sha256=ul3eiZNX2wwmInooo3PJC3_kNpdejYVDIo94G3sV9HQ,2941
@@ -11,7 +11,7 @@ fastled/keyboard.py,sha256=vyYxE98WCXjvMpcUJd0YXPVvt7TzvBmifLYI-K7jtKg,3524
11
11
  fastled/live_client.py,sha256=MDauol0mxtXggV1Pv9ahC0Jjg_4wnnV6FjGEtdd9cxU,2763
12
12
  fastled/open_browser.py,sha256=KX2h9PUaPsKcwZ84i01DrXOnNpvaKLpB63u5kzcnEKQ,4342
13
13
  fastled/open_browser2.py,sha256=jUgN81bEYX-sr0zKTVJkwj9tXEVq7aZTxGUP_ShyCbs,3614
14
- fastled/parse_args.py,sha256=d0Aa_XPOpTjgxkBPZ_UyG-xNP9PgEjBQgrtzykVBeSc,7887
14
+ fastled/parse_args.py,sha256=xgjxirQVX3FQxHZNVJtQQxTOeSJRQdGUNQ7W33Y880Y,8051
15
15
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
16
16
  fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
17
17
  fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffER2NfM,1314
@@ -26,9 +26,9 @@ fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
26
26
  fastled/site/build.py,sha256=l4RajIk0bApiAifT1lyLjIZi9lpPtSba4cnwWP5UOKc,14064
27
27
  fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
28
28
  fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
29
- fastled-1.2.41.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
30
- fastled-1.2.41.dist-info/METADATA,sha256=ZscaHfPqTwVv19ihdqqO6799oW8Q3PN58j6hUEFbAsc,21264
31
- fastled-1.2.41.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
32
- fastled-1.2.41.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
33
- fastled-1.2.41.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
34
- fastled-1.2.41.dist-info/RECORD,,
29
+ fastled-1.2.42.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
30
+ fastled-1.2.42.dist-info/METADATA,sha256=LptcuXR92sgrugDf_QEzO1X78SN3pjNkqHOFIRjtnzA,21264
31
+ fastled-1.2.42.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
32
+ fastled-1.2.42.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
33
+ fastled-1.2.42.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
34
+ fastled-1.2.42.dist-info/RECORD,,