fastled 1.3.1__py3-none-any.whl → 1.3.3__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 +2 -5
- fastled/__version__.py +6 -0
- fastled/docker_manager.py +19 -1
- fastled/print_filter.py +58 -1
- fastled/server_flask.py +25 -11
- fastled/version.py +41 -0
- {fastled-1.3.1.dist-info → fastled-1.3.3.dist-info}/METADATA +2 -2
- {fastled-1.3.1.dist-info → fastled-1.3.3.dist-info}/RECORD +12 -10
- {fastled-1.3.1.dist-info → fastled-1.3.3.dist-info}/WHEEL +0 -0
- {fastled-1.3.1.dist-info → fastled-1.3.3.dist-info}/entry_points.txt +0 -0
- {fastled-1.3.1.dist-info → fastled-1.3.3.dist-info}/licenses/LICENSE +0 -0
- {fastled-1.3.1.dist-info → fastled-1.3.3.dist-info}/top_level.txt +0 -0
fastled/__init__.py
CHANGED
@@ -5,17 +5,13 @@ from multiprocessing import Process
|
|
5
5
|
from pathlib import Path
|
6
6
|
from typing import Generator
|
7
7
|
|
8
|
+
from .__version__ import __version__
|
8
9
|
from .compile_server import CompileServer
|
9
10
|
from .live_client import LiveClient
|
10
11
|
from .settings import DOCKER_FILE, IMAGE_NAME
|
11
12
|
from .site.build import build
|
12
13
|
from .types import BuildMode, CompileResult, CompileServerError, FileResponse
|
13
14
|
|
14
|
-
# IMPORTANT! There's a bug in github which will REJECT any version update
|
15
|
-
# that has any other change in the repo. Please bump the version as the
|
16
|
-
# ONLY change in a commit, or else the pypi update and the release will fail.
|
17
|
-
__version__ = "1.3.1"
|
18
|
-
|
19
15
|
|
20
16
|
class Api:
|
21
17
|
@staticmethod
|
@@ -224,4 +220,5 @@ __all__ = [
|
|
224
220
|
"BuildMode",
|
225
221
|
"FileResponse",
|
226
222
|
"DOCKER_FILE",
|
223
|
+
"__version__",
|
227
224
|
]
|
fastled/__version__.py
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# IMPORTANT! There's a bug in github which will REJECT any version update
|
2
|
+
# that has any other change in the repo. Please bump the version as the
|
3
|
+
# ONLY change in a commit, or else the pypi update and the release will fail.
|
4
|
+
__version__ = "1.3.3"
|
5
|
+
|
6
|
+
__version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
|
fastled/docker_manager.py
CHANGED
@@ -366,7 +366,7 @@ class DockerManager:
|
|
366
366
|
Returns:
|
367
367
|
A tuple of (has_newer_version, message)
|
368
368
|
has_newer_version: True if a newer version is available, False otherwise
|
369
|
-
message: A message describing the result
|
369
|
+
message: A message describing the result, including the date of the newer version if available
|
370
370
|
"""
|
371
371
|
try:
|
372
372
|
# Get the local image
|
@@ -388,6 +388,24 @@ class DockerManager:
|
|
388
388
|
if remote_image_hash_from_local_image == remote_image_hash:
|
389
389
|
return False, f"Local image {image_name}:{tag} is up to date."
|
390
390
|
else:
|
391
|
+
# Get the creation date of the remote image if possible
|
392
|
+
try:
|
393
|
+
# Try to get detailed image info including creation date
|
394
|
+
remote_image_details = self.client.api.inspect_image(
|
395
|
+
f"{image_name}:{tag}"
|
396
|
+
)
|
397
|
+
if "Created" in remote_image_details:
|
398
|
+
created_date = remote_image_details["Created"].split("T")[
|
399
|
+
0
|
400
|
+
] # Extract just the date part
|
401
|
+
return (
|
402
|
+
True,
|
403
|
+
f"Newer version of {image_name}:{tag} is available (published on {created_date}).",
|
404
|
+
)
|
405
|
+
except Exception:
|
406
|
+
pass
|
407
|
+
|
408
|
+
# Fallback if we couldn't get the date
|
391
409
|
return True, f"Newer version of {image_name}:{tag} is available."
|
392
410
|
|
393
411
|
except ImageNotFound:
|
fastled/print_filter.py
CHANGED
@@ -94,8 +94,65 @@ class BuildArtifact:
|
|
94
94
|
compile_or_link: CompileOrLink
|
95
95
|
hash: int
|
96
96
|
|
97
|
+
def flags_pretty(self) -> str:
|
98
|
+
"""
|
99
|
+
Returns the flags in a pretty format.
|
100
|
+
This is used for printing the flags to the console.
|
101
|
+
"""
|
102
|
+
flags = self.build_flags
|
103
|
+
flags = flags.replace(" -I", "\n-I")
|
104
|
+
flags = flags.replace(" -D", "\n-D")
|
105
|
+
flags = flags.replace(" -l", "\n-l")
|
106
|
+
flags = flags.replace(" -L", "\n-L")
|
107
|
+
flags = flags.replace(" -o", "\n-o")
|
108
|
+
flags = flags.replace(" -W", "\n-W")
|
109
|
+
flags = flags.replace(" -f", "\n-f")
|
110
|
+
flags = flags.replace(" -g", "\n-g")
|
111
|
+
|
112
|
+
# break into lines and sort
|
113
|
+
lines = flags.splitlines()
|
114
|
+
first_line = lines[0]
|
115
|
+
lines.pop(0) # remove first line
|
116
|
+
lines = sorted(lines)
|
117
|
+
# remove duplicates
|
118
|
+
lines = list(dict.fromkeys(lines))
|
119
|
+
# remove empty lines
|
120
|
+
lines = [line for line in lines if line.strip() != ""]
|
121
|
+
# remove leading and trailing whitespace
|
122
|
+
lines = [line.strip() for line in lines]
|
123
|
+
lines = sorted(lines)
|
124
|
+
lines = [first_line] + lines # add first line back to the beginning
|
125
|
+
# stringify
|
126
|
+
flags = "\n".join(lines)
|
127
|
+
return flags
|
128
|
+
|
97
129
|
def __str__(self) -> str:
|
98
|
-
return f"{self.
|
130
|
+
return f"{self.brief()} {self.build_flags} {self.compile_or_link} {self.hash}"
|
131
|
+
|
132
|
+
def brief(self) -> str:
|
133
|
+
return f"{self.timestamp:.2f} {self.output_artifact}"
|
134
|
+
|
135
|
+
def begin_flags(self) -> str:
|
136
|
+
"""
|
137
|
+
Returns the flags that are used to begin a build.
|
138
|
+
This is the flags that are used for the first compile or link.
|
139
|
+
"""
|
140
|
+
|
141
|
+
out: str = (
|
142
|
+
"\n################ NEW COMPILE/LINK FLAG GROUP #####################\n\n"
|
143
|
+
)
|
144
|
+
out += f"{self.flags_pretty()}\n"
|
145
|
+
return out
|
146
|
+
|
147
|
+
def end_flags(self) -> str:
|
148
|
+
"""
|
149
|
+
Returns the flags that are used to end a build.
|
150
|
+
This is the flags that are used for the last compile or link.
|
151
|
+
"""
|
152
|
+
out: str = (
|
153
|
+
"\n################ END COMPILE/LINK FLAG GROUP #####################\n"
|
154
|
+
)
|
155
|
+
return out
|
99
156
|
|
100
157
|
@staticmethod
|
101
158
|
def parse(input_str: str) -> "BuildArtifact | None":
|
fastled/server_flask.py
CHANGED
@@ -26,6 +26,16 @@ else:
|
|
26
26
|
logger.disabled = True
|
27
27
|
|
28
28
|
|
29
|
+
def _is_dwarf_source(path: str) -> bool:
|
30
|
+
"""Check if the path is a dwarf source file."""
|
31
|
+
# Check if the path starts with "fastledsource/" or "sketchsource/"
|
32
|
+
return (
|
33
|
+
path.startswith("fastledsource/")
|
34
|
+
or path.startswith("sketchsource/")
|
35
|
+
or path.startswith("dwarfsource")
|
36
|
+
)
|
37
|
+
|
38
|
+
|
29
39
|
def _run_flask_server(
|
30
40
|
fastled_js: Path,
|
31
41
|
port: int,
|
@@ -137,15 +147,8 @@ def _run_flask_server(
|
|
137
147
|
|
138
148
|
start_time = time.time()
|
139
149
|
logger.info(f"Processing request: {request.method} {request.url}")
|
140
|
-
|
141
|
-
if "../" in path:
|
142
|
-
# Prevent directory traversal attacks
|
143
|
-
error_msg = "Directory traversal attack detected"
|
144
|
-
logger.error(error_msg)
|
145
|
-
return Response(error_msg, status=400)
|
146
|
-
|
147
150
|
# Forward the request to the compile server
|
148
|
-
target_url = f"http://localhost:{compile_server_port}/{path}"
|
151
|
+
target_url = f"http://localhost:{compile_server_port}/dwarfsource/{path}"
|
149
152
|
logger.info(f"Requesting: {target_url}")
|
150
153
|
logger.info(f"Processing dwarfsource request for {path}")
|
151
154
|
|
@@ -314,14 +317,25 @@ def _run_flask_server(
|
|
314
317
|
return Response(f"File not found: {path}", status=404)
|
315
318
|
return Response(f"Error serving file: {str(e)}", status=500)
|
316
319
|
|
320
|
+
@app.route("/fastapi")
|
321
|
+
def server_backend_redirect():
|
322
|
+
"""Redirect to the compile server"""
|
323
|
+
logger.info("Redirecting to compile server")
|
324
|
+
target_url = f"http://localhost:{compile_server_port}/docs"
|
325
|
+
logger.info(f"Redirecting to: {target_url}")
|
326
|
+
return Response(
|
327
|
+
f"Redirecting to compile server: <a href='{target_url}'>{target_url}</a>",
|
328
|
+
status=302,
|
329
|
+
headers={"Location": target_url},
|
330
|
+
)
|
331
|
+
|
317
332
|
@app.route("/<path:path>")
|
318
333
|
def serve_files(path: str):
|
319
334
|
logger.info(f"Received request for path: {path}")
|
320
335
|
|
321
336
|
try:
|
322
|
-
|
323
|
-
|
324
|
-
):
|
337
|
+
is_debug_src_code_request = _is_dwarf_source(path)
|
338
|
+
if is_debug_src_code_request:
|
325
339
|
logger.info(f"Handling as drawfsource: {path}")
|
326
340
|
return handle_fastledsource(path)
|
327
341
|
elif path.startswith("sourcefiles/"):
|
fastled/version.py
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
from concurrent.futures import Future, ThreadPoolExecutor
|
2
|
+
|
3
|
+
import httpx
|
4
|
+
|
5
|
+
from fastled.__version__ import __version_url_latest__
|
6
|
+
|
7
|
+
|
8
|
+
def _fetch_version() -> str | Exception:
|
9
|
+
"""
|
10
|
+
Helper function to fetch the latest version from the GitHub repository.
|
11
|
+
"""
|
12
|
+
try:
|
13
|
+
response = httpx.get(__version_url_latest__)
|
14
|
+
response.raise_for_status()
|
15
|
+
# Extract the version string from the response text
|
16
|
+
version_line = response.text.split("__version__ = ")[1].split('"')[1]
|
17
|
+
return version_line
|
18
|
+
except Exception as e:
|
19
|
+
return e
|
20
|
+
|
21
|
+
|
22
|
+
def get_latest_version() -> Future[str | Exception]:
|
23
|
+
"""
|
24
|
+
Fetch the latest version from the GitHub repository.
|
25
|
+
Returns a future that will resolve with the version string or an exception.
|
26
|
+
"""
|
27
|
+
executor = ThreadPoolExecutor()
|
28
|
+
return executor.submit(_fetch_version)
|
29
|
+
|
30
|
+
|
31
|
+
def unit_test() -> None:
|
32
|
+
future = get_latest_version()
|
33
|
+
latest_version = future.result() # Wait for the future to complete
|
34
|
+
if isinstance(latest_version, Exception):
|
35
|
+
print(f"Error fetching latest version: {latest_version}")
|
36
|
+
else:
|
37
|
+
print(f"Latest version: {latest_version}")
|
38
|
+
|
39
|
+
|
40
|
+
if __name__ == "__main__":
|
41
|
+
unit_test()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.3
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -20,7 +20,7 @@ Requires-Dist: progress>=1.6
|
|
20
20
|
Requires-Dist: watchfiles>=1.0.5
|
21
21
|
Requires-Dist: Flask>=3.0.0
|
22
22
|
Requires-Dist: livereload
|
23
|
-
Requires-Dist: fastled-wasm-server>=1.0.
|
23
|
+
Requires-Dist: fastled-wasm-server>=1.0.25
|
24
24
|
Dynamic: home-page
|
25
25
|
Dynamic: license-file
|
26
26
|
Dynamic: maintainer
|
@@ -1,4 +1,5 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=YLikXGRWKlKAqj7bpvGmJLejGTFF-FC1lv2z1jwRinA,6852
|
2
|
+
fastled/__version__.py,sha256=fo92Jlm3mAbIQsRDibjNwlWY6pHOmbsGtSCn2n2BU0k,372
|
2
3
|
fastled/app.py,sha256=1N5Q486YccaWCRqnaI2F04ktL64NAVjAN6i4c-zgm1o,5818
|
3
4
|
fastled/cli.py,sha256=5EBsb02ueFUjlgrlg0GMdj3e5nnHVhvofmYyQRaw8uM,565
|
4
5
|
fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
|
@@ -6,7 +7,7 @@ fastled/cli_test_interactive.py,sha256=BjNhveZOk5aCffHbcrxPQQjWmAuj4ClVKKcKX5eY6
|
|
6
7
|
fastled/client_server.py,sha256=falqUhGSHQpNfEXNCcQFPDAZymfncEVhIDcURBIJTFk,18390
|
7
8
|
fastled/compile_server.py,sha256=rkXvrvdav5vDG8lv_OlBX3YSCHtnHMt25nXbfeg_r78,2960
|
8
9
|
fastled/compile_server_impl.py,sha256=MIe-GvKenoDaqX8VhCJ7KNIWTOHHcLPgUQ7kO6lsa38,12199
|
9
|
-
fastled/docker_manager.py,sha256=
|
10
|
+
fastled/docker_manager.py,sha256=xtBGZUiz4UfFVik2eJYl6qD2BUGj4Jj6o-T0LY1iDYI,38052
|
10
11
|
fastled/filewatcher.py,sha256=3qS3L7zMQhFuVrkeGn1djsB_cB6x_E2YGJmmQWVAU_w,10033
|
11
12
|
fastled/keyboard.py,sha256=UTAsqCn1UMYnB8YDzENiLTj4GeL45tYfEcO7_5fLFEg,3556
|
12
13
|
fastled/keyz.py,sha256=LO-8m_7CpNDiZLM-FXhQ30f9gN1bUYz5lOsUPTIbI-c,4020
|
@@ -14,10 +15,10 @@ fastled/live_client.py,sha256=yoAul8tVgbbPf1oEC79SUZSHkLECxlrXxgWR9XaBIp4,2957
|
|
14
15
|
fastled/open_browser.py,sha256=DFyMrc1qic4Go7eLNPqMaLuMvTaE73NixdfSKV0yyp8,3709
|
15
16
|
fastled/parse_args.py,sha256=tP8-AiVxEsZ5xvsL8YFfkd5L1whM3wzLS37IX2HCNrk,9454
|
16
17
|
fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
|
17
|
-
fastled/print_filter.py,sha256=
|
18
|
+
fastled/print_filter.py,sha256=oomBjrouWNPCgJY2guCpljTijFvNKRBVbipDrxIsszA,7426
|
18
19
|
fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
|
19
20
|
fastled/select_sketch_directory.py,sha256=-eudwCns3AKj4HuHtSkZAFwbnf005SNL07pOzs9VxnE,1383
|
20
|
-
fastled/server_flask.py,sha256=
|
21
|
+
fastled/server_flask.py,sha256=HR7WNQWcxsOoKVvEc0Gs8YQQhEcwHZNwZ0gALuryioI,18271
|
21
22
|
fastled/server_start.py,sha256=W9yKStkRlRNuXeV6j_6O7HjjFPyVLBHMcF9Uy2QjDWQ,479
|
22
23
|
fastled/settings.py,sha256=dUVyJ8Mtprg0RwaS6oMWP8jBhr4C3R8fu4Hdx_Z1lCM,577
|
23
24
|
fastled/sketch.py,sha256=Ftbh55Nt-p4hmPuPpj8Q9HrMzvnUazhoG_q9FHcxkns,3473
|
@@ -25,6 +26,7 @@ fastled/spinner.py,sha256=VHxmvB92P0Z_zYxRajb5HiNmkHHvZ5dG7hKtZltzpcs,867
|
|
25
26
|
fastled/string_diff.py,sha256=NbtYxvBFxTUdmTpMLizlgZj2ULJ-7etj72GBdWDTGws,2496
|
26
27
|
fastled/types.py,sha256=k1j1y5h1zpRonp1mqRXy797mSbLqzf5K1QEgl8f27jQ,4822
|
27
28
|
fastled/util.py,sha256=hw3gxS1qGc5LL_QN88_VIjut6T0-61ImDQpxGp11DXY,1189
|
29
|
+
fastled/version.py,sha256=TpBMiEVdO3_sUZEu6wmwN8Q4AgX2BiCxStCsnPKh6E0,1209
|
28
30
|
fastled/web_compile.py,sha256=R159Od1VqeXTW6y3rQY0_P9f0CJYbPuBiMLqb-zBCUQ,11526
|
29
31
|
fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
|
30
32
|
fastled/assets/localhost-key.pem,sha256=Q-CNO_UoOd8fFNN4ljcnqwUeCMhzTplRjLO2x0pYRlU,1704
|
@@ -33,9 +35,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
|
|
33
35
|
fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
|
34
36
|
fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
|
35
37
|
fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
|
36
|
-
fastled-1.3.
|
37
|
-
fastled-1.3.
|
38
|
-
fastled-1.3.
|
39
|
-
fastled-1.3.
|
40
|
-
fastled-1.3.
|
41
|
-
fastled-1.3.
|
38
|
+
fastled-1.3.3.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
39
|
+
fastled-1.3.3.dist-info/METADATA,sha256=IkuFr7qUUMc4tgoPJIi-CcqN_Gj9h4J_IMzliYkBqoM,30049
|
40
|
+
fastled-1.3.3.dist-info/WHEEL,sha256=QZxptf4Y1BKFRCEDxD4h2V0mBFQOVFLFEpvxHmIs52A,91
|
41
|
+
fastled-1.3.3.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
42
|
+
fastled-1.3.3.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
|
43
|
+
fastled-1.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|