fastled 1.2.73__py3-none-any.whl → 1.2.75__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
@@ -13,7 +13,7 @@ from .types import BuildMode, CompileResult, CompileServerError
13
13
  # IMPORTANT! There's a bug in github which will REJECT any version update
14
14
  # that has any other change in the repo. Please bump the version as the
15
15
  # ONLY change in a commit, or else the pypi update and the release will fail.
16
- __version__ = "1.2.73"
16
+ __version__ = "1.2.75"
17
17
 
18
18
  DOCKER_FILE = (
19
19
  "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
fastled/docker_manager.py CHANGED
@@ -25,6 +25,7 @@ from docker.models.containers import Container
25
25
  from docker.models.images import Image
26
26
  from filelock import FileLock
27
27
 
28
+ from fastled.print_filter import PrintFilter
28
29
  from fastled.spinner import Spinner
29
30
 
30
31
  CONFIG_DIR = Path(user_data_dir("fastled", "fastled"))
@@ -99,8 +100,20 @@ class Volume:
99
100
  return volumes
100
101
 
101
102
 
103
+ # Override the default PrintFilter to use a custom one.
104
+ def make_default_print_filter() -> PrintFilter:
105
+ """Create a default PrintFilter instance."""
106
+ return PrintFilter()
107
+
108
+
102
109
  class RunningContainer:
103
- def __init__(self, container, first_run=False):
110
+ def __init__(
111
+ self,
112
+ container: Container,
113
+ first_run: bool = False,
114
+ filter: PrintFilter | None = None,
115
+ ) -> None:
116
+ self.filter = filter or make_default_print_filter()
104
117
  self.container = container
105
118
  self.first_run = first_run
106
119
  self.running = True
@@ -117,7 +130,8 @@ class RunningContainer:
117
130
  for log in self.container.logs(
118
131
  follow=False, since=from_date, until=to_date, stream=True
119
132
  ):
120
- print(log.decode("utf-8"), end="")
133
+ # print(log.decode("utf-8"), end="")
134
+ self.filter.print(log)
121
135
  time.sleep(0.1)
122
136
  from_date = to_date
123
137
  to_date = _utc_now_no_tz()
fastled/parse_args.py CHANGED
@@ -66,7 +66,7 @@ def parse_args() -> Args:
66
66
  parser.add_argument(
67
67
  "--profile",
68
68
  action="store_true",
69
- help="Enable profiling for web compilation",
69
+ help="Enable profiling of the C++ build system used for wasm compilation.",
70
70
  )
71
71
  parser.add_argument(
72
72
  "--force-compile",
@@ -79,6 +79,7 @@ def parse_args() -> Args:
79
79
  help="Disable automatic updates of the wasm compiler image when using docker.",
80
80
  )
81
81
  parser.add_argument(
82
+ "-u",
82
83
  "--update",
83
84
  "--upgrade",
84
85
  action="store_true",
@@ -89,7 +90,7 @@ def parse_args() -> Args:
89
90
  "--local",
90
91
  "-l",
91
92
  action="store_true",
92
- help="Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
93
+ help="(Default): Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
93
94
  )
94
95
  parser.add_argument(
95
96
  "--build",
@@ -0,0 +1,47 @@
1
+ import re
2
+
3
+
4
+ def _handle_ino_cpp(line: str) -> str:
5
+ if ".ino.cpp" in line[0:30]:
6
+ # Extract the filename without path and extension
7
+ match = re.search(r"src/([^/]+)\.ino\.cpp", line)
8
+ if match:
9
+ filename = match.group(1)
10
+ # Replace with examples/Filename/Filename.ino format
11
+ line = line.replace(
12
+ f"src/{filename}.ino.cpp", f"examples/{filename}/{filename}.ino"
13
+ )
14
+ else:
15
+ # Fall back to simple extension replacement if regex doesn't match
16
+ line = line.replace(".ino.cpp", ".ino")
17
+ return line
18
+
19
+
20
+ class PrintFilter:
21
+ """Provides filtering for text output so that source files match up with local names."""
22
+
23
+ def __init__(self, echo: bool = True) -> None:
24
+ self.echo = echo
25
+ self.build_started = False
26
+ pass
27
+
28
+ def _filter_all(self, text: str) -> str:
29
+ lines = text.splitlines()
30
+ out: list[str] = []
31
+ for line in lines:
32
+ if "# WASM is building" in line:
33
+ self.build_started = True
34
+ if self.build_started:
35
+ line = _handle_ino_cpp(line)
36
+ out.append(line)
37
+ text = "\n".join(out)
38
+ return text
39
+
40
+ def print(self, text: str | bytes) -> str:
41
+ """Prints the text to the console."""
42
+ if isinstance(text, bytes):
43
+ text = text.decode("utf-8")
44
+ text = self._filter_all(text)
45
+ if self.echo:
46
+ print(text, end="")
47
+ return text
@@ -20,7 +20,9 @@ def select_sketch_directory(
20
20
  print("\nMultiple Directories found, choose one:")
21
21
  for i, sketch_dir in enumerate(sketch_directories):
22
22
  print(f" [{i+1}]: {sketch_dir}")
23
- which = input("\nPlease specify a sketch directory: ").strip()
23
+ which = input(
24
+ "\nPlease specify a sketch directory\nYou can enter a number or type a fuzzy search: "
25
+ ).strip()
24
26
  try:
25
27
  index = int(which) - 1
26
28
  return str(sketch_directories[index])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.2.73
3
+ Version: 1.2.75
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -1,21 +1,22 @@
1
- fastled/__init__.py,sha256=V6FNkUzqFflqcAs4j_8yIr1_pTGeotxzTIuecfDzXws,6770
1
+ fastled/__init__.py,sha256=xipAccpkKKMAReisV4TKrsvg6jSwr47YOR_UQiOAQ0g,6770
2
2
  fastled/app.py,sha256=vteMH0WvWGkQq-FR6SdAzqJcHqx0Gcj-aclXYZL7n5Q,4073
3
3
  fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
4
4
  fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
5
5
  fastled/client_server.py,sha256=eG82h-27Y40szCew976lv9I6bP-YxtRV6sFNDVNTapo,14525
6
6
  fastled/compile_server.py,sha256=rkXvrvdav5vDG8lv_OlBX3YSCHtnHMt25nXbfeg_r78,2960
7
7
  fastled/compile_server_impl.py,sha256=LnvxeSgBQ3lvey3_dz71UnJjCb5WTUQaPYtuSc1BMvo,10706
8
- fastled/docker_manager.py,sha256=ULtA3THPfaoz9QyoilI2Y67y6B3Ly7F7glP5Vuz1_TY,34698
8
+ fastled/docker_manager.py,sha256=1qKM_Ufp3hD3FcS8uUy5mV4s7ogJ92AR-qTida8QV3U,35129
9
9
  fastled/filewatcher.py,sha256=3qS3L7zMQhFuVrkeGn1djsB_cB6x_E2YGJmmQWVAU_w,10033
10
10
  fastled/interactive_srcs.py,sha256=F5nHdJc60xsnmOtnKhngE9JytqGn56PmYw_MVSIX1ac,138
11
11
  fastled/keyboard.py,sha256=UTAsqCn1UMYnB8YDzENiLTj4GeL45tYfEcO7_5fLFEg,3556
12
12
  fastled/keyz.py,sha256=LO-8m_7CpNDiZLM-FXhQ30f9gN1bUYz5lOsUPTIbI-c,4020
13
13
  fastled/live_client.py,sha256=MDauol0mxtXggV1Pv9ahC0Jjg_4wnnV6FjGEtdd9cxU,2763
14
14
  fastled/open_browser.py,sha256=Fv1w645rrVROaW4jjyU70Cfz6QPbyIqjK5yu16lhBlo,3836
15
- fastled/parse_args.py,sha256=4BWlPaRAGnRYGyywnhhPciPOlNEXflOlycSyrdDX8lU,8056
15
+ fastled/parse_args.py,sha256=Y6ZNjMNkXiXvGs_oa-2RgwSH7Yb-Ogpi4pzLBf455II,8112
16
16
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
17
+ fastled/print_filter.py,sha256=IijutPR_gmyM6Jjm6b7h1UGHNcjiNoAdO_cWihMWT4I,1512
17
18
  fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
18
- fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffER2NfM,1314
19
+ fastled/select_sketch_directory.py,sha256=-eudwCns3AKj4HuHtSkZAFwbnf005SNL07pOzs9VxnE,1383
19
20
  fastled/server_fastapi.py,sha256=ytsL4poO-yugDIhvYJq6nCNdLZ4fQJ1AFqXkF-uEkqo,1488
20
21
  fastled/server_fastapi_cli.py,sha256=fJGLvbJx5ertsZER_lgg0GfkYTX-V2rxzbNO1lEapU0,1392
21
22
  fastled/server_flask.py,sha256=i0OtDdrjiF9hjKNnI2ebf6Ag-mxMmtUCxnuHMBOzx7I,4665
@@ -34,9 +35,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
34
35
  fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
35
36
  fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
36
37
  fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
37
- fastled-1.2.73.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
38
- fastled-1.2.73.dist-info/METADATA,sha256=qvN0JAIPGX6FVEMBi1wqScmoGrmrnLCV6DpA8ib3Az8,22065
39
- fastled-1.2.73.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
40
- fastled-1.2.73.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
41
- fastled-1.2.73.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
42
- fastled-1.2.73.dist-info/RECORD,,
38
+ fastled-1.2.75.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
39
+ fastled-1.2.75.dist-info/METADATA,sha256=9bfoTdPGaNXYG5VCTNQHAkna4UC3DlDO4f0KjqG3cjA,22065
40
+ fastled-1.2.75.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
41
+ fastled-1.2.75.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
42
+ fastled-1.2.75.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
43
+ fastled-1.2.75.dist-info/RECORD,,