fastled 1.2.76__py3-none-any.whl → 1.2.77__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 +3 -6
- fastled/app.py +28 -10
- fastled/cli_test_interactive.py +21 -0
- fastled/compile_server_impl.py +39 -1
- fastled/print_filter.py +7 -0
- fastled/settings.py +4 -0
- {fastled-1.2.76.dist-info → fastled-1.2.77.dist-info}/METADATA +1 -1
- {fastled-1.2.76.dist-info → fastled-1.2.77.dist-info}/RECORD +12 -11
- {fastled-1.2.76.dist-info → fastled-1.2.77.dist-info}/WHEEL +0 -0
- {fastled-1.2.76.dist-info → fastled-1.2.77.dist-info}/entry_points.txt +0 -0
- {fastled-1.2.76.dist-info → fastled-1.2.77.dist-info}/licenses/LICENSE +0 -0
- {fastled-1.2.76.dist-info → fastled-1.2.77.dist-info}/top_level.txt +0 -0
fastled/__init__.py
CHANGED
@@ -7,17 +7,14 @@ from typing import Generator
|
|
7
7
|
|
8
8
|
from .compile_server import CompileServer
|
9
9
|
from .live_client import LiveClient
|
10
|
+
from .settings import DOCKER_FILE, IMAGE_NAME
|
10
11
|
from .site.build import build
|
11
12
|
from .types import BuildMode, CompileResult, CompileServerError
|
12
13
|
|
13
14
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
14
15
|
# that has any other change in the repo. Please bump the version as the
|
15
16
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
16
|
-
__version__ = "1.2.
|
17
|
-
|
18
|
-
DOCKER_FILE = (
|
19
|
-
"https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
|
20
|
-
)
|
17
|
+
__version__ = "1.2.77"
|
21
18
|
|
22
19
|
|
23
20
|
class Api:
|
@@ -154,7 +151,6 @@ class Docker:
|
|
154
151
|
@staticmethod
|
155
152
|
def purge() -> None:
|
156
153
|
from fastled.docker_manager import DockerManager
|
157
|
-
from fastled.settings import IMAGE_NAME
|
158
154
|
|
159
155
|
docker_mgr = DockerManager()
|
160
156
|
docker_mgr.purge(image_name=IMAGE_NAME)
|
@@ -217,4 +213,5 @@ __all__ = [
|
|
217
213
|
"CompileResult",
|
218
214
|
"CompileServerError",
|
219
215
|
"BuildMode",
|
216
|
+
"DOCKER_FILE",
|
220
217
|
]
|
fastled/app.py
CHANGED
@@ -68,19 +68,37 @@ def main() -> int:
|
|
68
68
|
print("Building is disabled")
|
69
69
|
build = False
|
70
70
|
|
71
|
-
if
|
72
|
-
raise NotImplementedError("Building is not yet supported.")
|
71
|
+
if interactive:
|
72
|
+
# raise NotImplementedError("Building is not yet supported.")
|
73
73
|
file_watcher_set(False)
|
74
|
-
project_root = Path(".").absolute()
|
75
|
-
print(f"Building Docker image at {project_root}")
|
76
|
-
from fastled import Api
|
77
|
-
|
78
|
-
server = Docker.spawn_server_from_fastled_repo(
|
79
|
-
|
74
|
+
# project_root = Path(".").absolute()
|
75
|
+
# print(f"Building Docker image at {project_root}")
|
76
|
+
from fastled import Api
|
77
|
+
|
78
|
+
# server = Docker.spawn_server_from_fastled_repo(
|
79
|
+
# project_root=project_root,
|
80
|
+
# interactive=interactive,
|
81
|
+
# sketch_folder=directory,
|
82
|
+
# )
|
83
|
+
# assert isinstance(server, CompileServer)
|
84
|
+
server: CompileServer = CompileServer(
|
80
85
|
interactive=interactive,
|
81
|
-
|
86
|
+
auto_updates=False,
|
87
|
+
mapped_dir=directory,
|
88
|
+
auto_start=False,
|
89
|
+
remove_previous=False,
|
82
90
|
)
|
83
|
-
|
91
|
+
|
92
|
+
server.start(wait_for_startup=False)
|
93
|
+
|
94
|
+
try:
|
95
|
+
while server.process_running():
|
96
|
+
# wait for ctrl-c
|
97
|
+
time.sleep(0.1)
|
98
|
+
except KeyboardInterrupt:
|
99
|
+
print("\nExiting from server...")
|
100
|
+
server.stop()
|
101
|
+
return 0
|
84
102
|
|
85
103
|
try:
|
86
104
|
if interactive:
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
from fastled.app import main as app_main
|
4
|
+
|
5
|
+
if __name__ == "__main__":
|
6
|
+
# Note that the entry point for the exe is in cli.py
|
7
|
+
try:
|
8
|
+
import os
|
9
|
+
|
10
|
+
os.chdir("../fastled")
|
11
|
+
# sys.argv.append("--server")
|
12
|
+
# sys.argv.append("--local")
|
13
|
+
sys.argv.append("examples/FxWave2d")
|
14
|
+
sys.argv.append("-i")
|
15
|
+
sys.exit(app_main())
|
16
|
+
except KeyboardInterrupt:
|
17
|
+
print("\nExiting from main...")
|
18
|
+
sys.exit(1)
|
19
|
+
except Exception as e:
|
20
|
+
print(f"Error: {e}")
|
21
|
+
sys.exit(1)
|
fastled/compile_server_impl.py
CHANGED
@@ -37,6 +37,32 @@ def _try_get_fastled_src(path: Path) -> Path | None:
|
|
37
37
|
return None
|
38
38
|
|
39
39
|
|
40
|
+
def _port_is_free(port: int) -> bool:
|
41
|
+
"""Check if a port is free."""
|
42
|
+
import socket
|
43
|
+
|
44
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
45
|
+
try:
|
46
|
+
sock.bind(("localhost", port)) and sock.bind(("0.0.0.0", port))
|
47
|
+
return True
|
48
|
+
except OSError:
|
49
|
+
return False
|
50
|
+
|
51
|
+
|
52
|
+
def _find_free_port() -> int:
|
53
|
+
"""Find a free port on the system."""
|
54
|
+
|
55
|
+
start_port = 49152
|
56
|
+
tries = 10
|
57
|
+
|
58
|
+
for port in range(start_port, start_port + tries):
|
59
|
+
if _port_is_free(port):
|
60
|
+
return port
|
61
|
+
raise RuntimeError(
|
62
|
+
f"No free port found in the range {start_port}-{start_port + tries - 1}"
|
63
|
+
)
|
64
|
+
|
65
|
+
|
40
66
|
class CompileServerImpl:
|
41
67
|
def __init__(
|
42
68
|
self,
|
@@ -202,6 +228,7 @@ class CompileServerImpl:
|
|
202
228
|
image_name=IMAGE_NAME, tag="latest", upgrade=upgrade
|
203
229
|
)
|
204
230
|
DISK_CACHE.put("last-update", now_str)
|
231
|
+
CLIENT_PORT = 80 # TODO: Don't use port 80.
|
205
232
|
|
206
233
|
print("Docker image now validated")
|
207
234
|
port = SERVER_PORT
|
@@ -209,7 +236,11 @@ class CompileServerImpl:
|
|
209
236
|
server_command = ["/bin/bash"]
|
210
237
|
else:
|
211
238
|
server_command = ["python", "/js/run.py", "server"] + SERVER_OPTIONS
|
212
|
-
|
239
|
+
if self.interactive:
|
240
|
+
print("Disabling port forwarding in interactive mode")
|
241
|
+
ports = {}
|
242
|
+
else:
|
243
|
+
ports = {CLIENT_PORT: port}
|
213
244
|
volumes = []
|
214
245
|
if self.fastled_src_dir:
|
215
246
|
print(
|
@@ -269,6 +300,13 @@ class CompileServerImpl:
|
|
269
300
|
print("Compile server starting")
|
270
301
|
return port
|
271
302
|
else:
|
303
|
+
client_port_mapped = CLIENT_PORT in ports
|
304
|
+
port_is_free = _port_is_free(CLIENT_PORT)
|
305
|
+
if client_port_mapped and port_is_free:
|
306
|
+
warnings.warn(
|
307
|
+
f"Can't expose port {CLIENT_PORT}, disabling port forwarding in interactive mode"
|
308
|
+
)
|
309
|
+
ports = {}
|
272
310
|
self.docker.run_container_interactive(
|
273
311
|
image_name=IMAGE_NAME,
|
274
312
|
tag="latest",
|
fastled/print_filter.py
CHANGED
@@ -39,6 +39,10 @@ def _handle_ino_cpp(line: str) -> str:
|
|
39
39
|
return line
|
40
40
|
|
41
41
|
|
42
|
+
def _handle_fastled_src(line: str) -> str:
|
43
|
+
return line.replace("fastled/src", "src")
|
44
|
+
|
45
|
+
|
42
46
|
class PrintFilterDefault(PrintFilter):
|
43
47
|
"""Provides default filtering for FastLED output."""
|
44
48
|
|
@@ -61,6 +65,9 @@ class PrintFilterFastled(PrintFilter):
|
|
61
65
|
# print(line)
|
62
66
|
if "# WASM is building" in line:
|
63
67
|
self.build_started = True
|
68
|
+
line = _handle_fastled_src(
|
69
|
+
line
|
70
|
+
) # Always convert fastled/src to src for file matchups.
|
64
71
|
if self.build_started or " error: " in line:
|
65
72
|
line = _handle_ino_cpp(line)
|
66
73
|
out.append(line)
|
fastled/settings.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
2
|
-
fastled/app.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=jcXru6wq69PDDaohulLi5gYXikZoeAqi7YJVuNV-LJg,6680
|
2
|
+
fastled/app.py,sha256=0W8Mbplo5UCRzj7nMVgkmCBddQGufsUQjkUUT4pMp74,4611
|
3
3
|
fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
|
4
4
|
fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
|
5
|
+
fastled/cli_test_interactive.py,sha256=BjNhveZOk5aCffHbcrxPQQjWmAuj4ClVKKcKX5eY6yM,542
|
5
6
|
fastled/client_server.py,sha256=eG82h-27Y40szCew976lv9I6bP-YxtRV6sFNDVNTapo,14525
|
6
7
|
fastled/compile_server.py,sha256=rkXvrvdav5vDG8lv_OlBX3YSCHtnHMt25nXbfeg_r78,2960
|
7
|
-
fastled/compile_server_impl.py,sha256=
|
8
|
+
fastled/compile_server_impl.py,sha256=dfybPABcSu1Go0CaqpUP56vbaELMlr-ER-CwSYhaCCE,11903
|
8
9
|
fastled/docker_manager.py,sha256=SC_qV6grNTGh0QD1ubKrULQblrN-2PORocISlaZg9NQ,35156
|
9
10
|
fastled/filewatcher.py,sha256=3qS3L7zMQhFuVrkeGn1djsB_cB6x_E2YGJmmQWVAU_w,10033
|
10
11
|
fastled/interactive_srcs.py,sha256=F5nHdJc60xsnmOtnKhngE9JytqGn56PmYw_MVSIX1ac,138
|
@@ -14,14 +15,14 @@ fastled/live_client.py,sha256=MDauol0mxtXggV1Pv9ahC0Jjg_4wnnV6FjGEtdd9cxU,2763
|
|
14
15
|
fastled/open_browser.py,sha256=Fv1w645rrVROaW4jjyU70Cfz6QPbyIqjK5yu16lhBlo,3836
|
15
16
|
fastled/parse_args.py,sha256=lF63joIP2rN706n1rbxmBhWyogN91zjocyFtTVHOnds,9306
|
16
17
|
fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
|
17
|
-
fastled/print_filter.py,sha256=
|
18
|
+
fastled/print_filter.py,sha256=ZpebuqfWEraSBD3Dm0PVZhQVBnU_NSILniwBHwjC1qM,2342
|
18
19
|
fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
|
19
20
|
fastled/select_sketch_directory.py,sha256=-eudwCns3AKj4HuHtSkZAFwbnf005SNL07pOzs9VxnE,1383
|
20
21
|
fastled/server_fastapi.py,sha256=ytsL4poO-yugDIhvYJq6nCNdLZ4fQJ1AFqXkF-uEkqo,1488
|
21
22
|
fastled/server_fastapi_cli.py,sha256=fJGLvbJx5ertsZER_lgg0GfkYTX-V2rxzbNO1lEapU0,1392
|
22
23
|
fastled/server_flask.py,sha256=i0OtDdrjiF9hjKNnI2ebf6Ag-mxMmtUCxnuHMBOzx7I,4665
|
23
24
|
fastled/server_start.py,sha256=NfAV5pWdXn2HDvqiMrpHxuNqh2vnB4xVFltV5Pn16GM,3509
|
24
|
-
fastled/settings.py,sha256=
|
25
|
+
fastled/settings.py,sha256=oezRvRUJWwauO-kpC4LDbKg6Q-ij4d09UtR2vkjSAPU,575
|
25
26
|
fastled/sketch.py,sha256=tHckjDj8P6BI_LWzUFM071a9qcqPs-r-qFWIe50P5Xw,3391
|
26
27
|
fastled/spinner.py,sha256=VHxmvB92P0Z_zYxRajb5HiNmkHHvZ5dG7hKtZltzpcs,867
|
27
28
|
fastled/string_diff.py,sha256=NbtYxvBFxTUdmTpMLizlgZj2ULJ-7etj72GBdWDTGws,2496
|
@@ -35,9 +36,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
|
|
35
36
|
fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
|
36
37
|
fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
|
37
38
|
fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
|
38
|
-
fastled-1.2.
|
39
|
-
fastled-1.2.
|
40
|
-
fastled-1.2.
|
41
|
-
fastled-1.2.
|
42
|
-
fastled-1.2.
|
43
|
-
fastled-1.2.
|
39
|
+
fastled-1.2.77.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
40
|
+
fastled-1.2.77.dist-info/METADATA,sha256=8iJ_j3x7Iemf1vLZr3-eLPDE2pFfSXs_ObEs1A0XC4Y,22065
|
41
|
+
fastled-1.2.77.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
42
|
+
fastled-1.2.77.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
43
|
+
fastled-1.2.77.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
|
44
|
+
fastled-1.2.77.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|