fastled 1.1.15__tar.gz → 1.1.16__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.
- {fastled-1.1.15 → fastled-1.1.16}/PKG-INFO +5 -2
- {fastled-1.1.15 → fastled-1.1.16}/README.md +1 -0
- {fastled-1.1.15 → fastled-1.1.16}/pyproject.toml +3 -1
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/__init__.py +1 -1
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/app.py +4 -10
- fastled-1.1.16/src/fastled/compile_server.py +156 -0
- fastled-1.1.16/src/fastled/docker_manager.py +513 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/web_compile.py +3 -8
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled.egg-info/PKG-INFO +5 -2
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled.egg-info/requires.txt +2 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_compile_server.py +0 -1
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_embedded_data.py +0 -1
- fastled-1.1.15/src/fastled/compile_server.py +0 -221
- fastled-1.1.15/src/fastled/docker_manager.py +0 -261
- {fastled-1.1.15 → fastled-1.1.16}/.aiderignore +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.github/workflows/lint.yml +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.github/workflows/test_win.yml +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.gitignore +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.pylintrc +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.vscode/launch.json +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.vscode/settings.json +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/.vscode/tasks.json +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/LICENSE +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/MANIFEST.in +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/clean +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/docs/fastled.js +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/docs/fastled.wasm +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/docs/index.css +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/docs/index.html +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/docs/index.js +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Blink/Blink.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/Chromancer.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/detail.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/gary_woos_wled_port/gary_woos_wled_ledmap.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/gary_woos_wled_port/presets.json +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/gary_woos_wled_port/presets.min.json +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/gen.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/mapping.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/net.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/output.json +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/ripple.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Chromancer/screenmap.json.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/ColorPalette/ColorPalette.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/ColorTemperature/ColorTemperature.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Cylon/Cylon.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/DemoReel100/DemoReel100.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Esp32Rmt51/Esp32Rmt51.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/EspI2SDemo/EspI2SDemo.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Fire2012/Fire2012.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Fire2012WithPalette/Fire2012WithPalette.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/FirstLight/FirstLight.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/FxEngine/FxEngine.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Noise/Noise.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/NoisePlayground/NoisePlayground.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/NoisePlusPalette/NoisePlusPalette.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/OctoWS2811/OctoWS2811.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Pacifica/Pacifica.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Pride2015/Pride2015.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/SdCard/SdCard.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/SdCard/screenmap.json.h +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/TwinkleFox/TwinkleFox.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Video/Gfx2Video/Gfx2Video.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/WasmScreenCoords/WasmScreenCoords.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/Water/Water.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/XYMatrix/XYMatrix.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/examples/wasm/wasm.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/install +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/lint +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/requirements.testing.txt +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/setup.cfg +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/setup.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/assets/example.txt +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/build_mode.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/cli.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/filewatcher.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/keyboard.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/open_browser.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/paths.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/sketch.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled/util.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled.egg-info/SOURCES.txt +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/test +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_bad_ino.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_cli.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_filechanger.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_ino/bad/bad.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_server_and_client_seperatly.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/tests/test_webcompile.py +0 -0
- {fastled-1.1.15 → fastled-1.1.16}/upload_package.sh +0 -0
@@ -1,13 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.16
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
7
7
|
License: BSD 3-Clause License
|
8
8
|
Keywords: template-python-cmd
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
|
-
Requires-Python: >=3.
|
10
|
+
Requires-Python: >=3.9
|
11
11
|
Description-Content-Type: text/markdown
|
12
12
|
License-File: LICENSE
|
13
13
|
Requires-Dist: docker
|
@@ -16,6 +16,8 @@ Requires-Dist: watchdog
|
|
16
16
|
Requires-Dist: livereload
|
17
17
|
Requires-Dist: download
|
18
18
|
Requires-Dist: filelock
|
19
|
+
Requires-Dist: disklru>=2.0.1
|
20
|
+
Requires-Dist: appdirs
|
19
21
|
|
20
22
|
# FastLED Wasm compiler
|
21
23
|
|
@@ -159,6 +161,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
|
|
159
161
|
|
160
162
|
# Revisions
|
161
163
|
|
164
|
+
* 1.1.16 - Rewrote docker logic to use container suspension and resumption. Much much faster.
|
162
165
|
* 1.1.15 - Fixed logic for considering ipv6 addresses. Auto selection of ipv6 is now restored.
|
163
166
|
* 1.1.14 - Fixes for regression in using --server and --localhost as two instances, this is now under test.
|
164
167
|
* 1.1.13 - Disable the use of ipv6. It produces random timeouts on the onrender server we are using for the web compiler.
|
@@ -140,6 +140,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
|
|
140
140
|
|
141
141
|
# Revisions
|
142
142
|
|
143
|
+
* 1.1.16 - Rewrote docker logic to use container suspension and resumption. Much much faster.
|
143
144
|
* 1.1.15 - Fixed logic for considering ipv6 addresses. Auto selection of ipv6 is now restored.
|
144
145
|
* 1.1.14 - Fixes for regression in using --server and --localhost as two instances, this is now under test.
|
145
146
|
* 1.1.13 - Disable the use of ipv6. It produces random timeouts on the onrender server we are using for the web compiler.
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
6
6
|
name = "fastled"
|
7
7
|
readme = "README.md"
|
8
8
|
description = "FastLED Wasm Compiler"
|
9
|
-
requires-python = ">=3.
|
9
|
+
requires-python = ">=3.9"
|
10
10
|
keywords = ["template-python-cmd"]
|
11
11
|
license = { text = "BSD 3-Clause License" }
|
12
12
|
classifiers = ["Programming Language :: Python :: 3"]
|
@@ -17,6 +17,8 @@ dependencies = [
|
|
17
17
|
"livereload",
|
18
18
|
"download",
|
19
19
|
"filelock",
|
20
|
+
"disklru>=2.0.1",
|
21
|
+
"appdirs",
|
20
22
|
]
|
21
23
|
|
22
24
|
dynamic = ["version"]
|
@@ -44,9 +44,6 @@ class CompiledResult:
|
|
44
44
|
hash_value: str | None
|
45
45
|
|
46
46
|
|
47
|
-
DOCKER = DockerManager(container_name=CONTAINER_NAME)
|
48
|
-
|
49
|
-
|
50
47
|
def parse_args() -> argparse.Namespace:
|
51
48
|
"""Parse command-line arguments."""
|
52
49
|
parser = argparse.ArgumentParser(description=f"FastLED WASM Compiler {__version__}")
|
@@ -252,7 +249,7 @@ def run_client(args: argparse.Namespace) -> int:
|
|
252
249
|
return 1
|
253
250
|
|
254
251
|
# If not explicitly using web compiler, check Docker installation
|
255
|
-
if not args.web and not
|
252
|
+
if not args.web and not DockerManager.is_docker_installed():
|
256
253
|
print(
|
257
254
|
"\nDocker is not installed on this system - switching to web compiler instead."
|
258
255
|
)
|
@@ -304,9 +301,7 @@ def run_client(args: argparse.Namespace) -> int:
|
|
304
301
|
if open_web_browser:
|
305
302
|
browser_proc = open_browser_thread(Path(args.directory) / "fastled_js")
|
306
303
|
else:
|
307
|
-
print(
|
308
|
-
"\nCompilation successful. Run without --just-compile to open in browser and watch for changes."
|
309
|
-
)
|
304
|
+
print("\nCompilation successful.")
|
310
305
|
if compile_server:
|
311
306
|
print("Shutting down compile server...")
|
312
307
|
compile_server.stop()
|
@@ -432,9 +427,8 @@ def main() -> int:
|
|
432
427
|
|
433
428
|
if __name__ == "__main__":
|
434
429
|
try:
|
435
|
-
|
436
|
-
sys.argv.append("
|
437
|
-
sys.argv.append("--localhost")
|
430
|
+
os.chdir("../fastled")
|
431
|
+
sys.argv.append("--server")
|
438
432
|
sys.exit(main())
|
439
433
|
except KeyboardInterrupt:
|
440
434
|
print("\nExiting from main...")
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import subprocess
|
2
|
+
import time
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
import httpx
|
6
|
+
|
7
|
+
from fastled.docker_manager import DISK_CACHE, DockerManager, RunningContainer
|
8
|
+
from fastled.sketch import looks_like_fastled_repo
|
9
|
+
|
10
|
+
_IMAGE_NAME = "niteris/fastled-wasm"
|
11
|
+
_DEFAULT_CONTAINER_NAME = "fastled-wasm-compiler"
|
12
|
+
|
13
|
+
SERVER_PORT = 9021
|
14
|
+
|
15
|
+
SERVER_OPTIONS = ["--allow-shutdown", "--no-auto-update"]
|
16
|
+
|
17
|
+
|
18
|
+
class CompileServer:
|
19
|
+
def __init__(
|
20
|
+
self,
|
21
|
+
container_name=_DEFAULT_CONTAINER_NAME,
|
22
|
+
interactive: bool = False,
|
23
|
+
) -> None:
|
24
|
+
|
25
|
+
cwd = Path(".").resolve()
|
26
|
+
fastled_src_dir: Path | None = None
|
27
|
+
if looks_like_fastled_repo(cwd):
|
28
|
+
print(
|
29
|
+
"Looks like a FastLED repo, using it as the source directory and mapping it into the server."
|
30
|
+
)
|
31
|
+
fastled_src_dir = cwd / "src"
|
32
|
+
|
33
|
+
self.container_name = container_name
|
34
|
+
self.docker = DockerManager()
|
35
|
+
self.fastled_src_dir: Path | None = fastled_src_dir
|
36
|
+
self.interactive = interactive
|
37
|
+
self.running_container: RunningContainer | None = None
|
38
|
+
self._port = self._start()
|
39
|
+
# fancy print
|
40
|
+
if not interactive:
|
41
|
+
msg = f"# FastLED Compile Server started at {self.url()} #"
|
42
|
+
print("\n" + "#" * len(msg))
|
43
|
+
print(msg)
|
44
|
+
print("#" * len(msg) + "\n")
|
45
|
+
|
46
|
+
@property
|
47
|
+
def running(self) -> bool:
|
48
|
+
if not self._port:
|
49
|
+
return False
|
50
|
+
if not DockerManager.is_docker_installed():
|
51
|
+
return False
|
52
|
+
if not DockerManager.is_running():
|
53
|
+
return False
|
54
|
+
return self.docker.is_container_running(self.container_name)
|
55
|
+
|
56
|
+
def using_fastled_src_dir_volume(self) -> bool:
|
57
|
+
return self.fastled_src_dir is not None
|
58
|
+
|
59
|
+
def port(self) -> int:
|
60
|
+
return self._port
|
61
|
+
|
62
|
+
def url(self) -> str:
|
63
|
+
return f"http://localhost:{self._port}"
|
64
|
+
|
65
|
+
def wait_for_startup(self, timeout: int = 100) -> bool:
|
66
|
+
"""Wait for the server to start up."""
|
67
|
+
start_time = time.time()
|
68
|
+
while time.time() - start_time < timeout:
|
69
|
+
# ping the server to see if it's up
|
70
|
+
if not self._port:
|
71
|
+
return False
|
72
|
+
# use httpx to ping the server
|
73
|
+
# if successful, return True
|
74
|
+
try:
|
75
|
+
response = httpx.get(
|
76
|
+
f"http://localhost:{self._port}", follow_redirects=True
|
77
|
+
)
|
78
|
+
if response.status_code < 400:
|
79
|
+
return True
|
80
|
+
except KeyboardInterrupt:
|
81
|
+
raise
|
82
|
+
except Exception:
|
83
|
+
pass
|
84
|
+
time.sleep(0.1)
|
85
|
+
if not self.docker.is_container_running(self.container_name):
|
86
|
+
return False
|
87
|
+
return False
|
88
|
+
|
89
|
+
def _start(self) -> int:
|
90
|
+
print("Compiling server starting")
|
91
|
+
|
92
|
+
# Ensure Docker is running
|
93
|
+
with self.docker.get_lock():
|
94
|
+
if not self.docker.is_running():
|
95
|
+
if not self.docker.start():
|
96
|
+
print("Docker could not be started. Exiting.")
|
97
|
+
raise RuntimeError("Docker could not be started. Exiting.")
|
98
|
+
from datetime import datetime, timezone
|
99
|
+
|
100
|
+
now = datetime.now(timezone.utc)
|
101
|
+
now_str = now.strftime("%Y-%m-%d %H %Z")
|
102
|
+
prev_date_str = DISK_CACHE.get("last-update")
|
103
|
+
|
104
|
+
upgrade = False
|
105
|
+
if prev_date_str != now_str:
|
106
|
+
print("New day, upgrading Docker image")
|
107
|
+
upgrade = True
|
108
|
+
|
109
|
+
self.docker.validate_or_download_image(
|
110
|
+
image_name=_IMAGE_NAME, tag="main", upgrade=upgrade
|
111
|
+
)
|
112
|
+
DISK_CACHE.put("last-update", now_str)
|
113
|
+
|
114
|
+
print("Docker image now validated")
|
115
|
+
port = SERVER_PORT
|
116
|
+
if self.interactive:
|
117
|
+
server_command = ["/bin/bash"]
|
118
|
+
else:
|
119
|
+
server_command = ["python", "/js/run.py", "server"] + SERVER_OPTIONS
|
120
|
+
server_cmd_str = subprocess.list2cmdline(server_command)
|
121
|
+
print(f"Started Docker container with command: {server_cmd_str}")
|
122
|
+
ports = {80: port}
|
123
|
+
volumes = None
|
124
|
+
if self.fastled_src_dir:
|
125
|
+
print(
|
126
|
+
f"Mounting FastLED source directory {self.fastled_src_dir} into container /host/fastled/src"
|
127
|
+
)
|
128
|
+
volumes = {
|
129
|
+
str(self.fastled_src_dir): {"bind": "/host/fastled/src", "mode": "ro"}
|
130
|
+
}
|
131
|
+
|
132
|
+
cmd_str = subprocess.list2cmdline(server_command)
|
133
|
+
|
134
|
+
self.docker.run_container(
|
135
|
+
image_name=_IMAGE_NAME,
|
136
|
+
tag="main",
|
137
|
+
container_name=self.container_name,
|
138
|
+
command=cmd_str,
|
139
|
+
ports=ports,
|
140
|
+
volumes=volumes,
|
141
|
+
)
|
142
|
+
self.running_container = self.docker.attach_and_run(self.container_name)
|
143
|
+
assert self.running_container is not None, "Container should be running"
|
144
|
+
|
145
|
+
print("Compile server starting")
|
146
|
+
return port
|
147
|
+
|
148
|
+
def proceess_running(self) -> bool:
|
149
|
+
return self.docker.is_container_running(self.container_name)
|
150
|
+
|
151
|
+
def stop(self) -> None:
|
152
|
+
# print(f"Stopping server on port {self._port}")
|
153
|
+
if self.running_container:
|
154
|
+
self.running_container.stop()
|
155
|
+
self.docker.suspend_container(self.container_name)
|
156
|
+
print("Compile server stopped")
|