fastled 1.2.83__tar.gz → 1.2.86__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.2.83 → fastled-1.2.86}/.gitignore +1 -0
- {fastled-1.2.83 → fastled-1.2.86}/PKG-INFO +1 -1
- fastled-1.2.86/build_local_docker.py +47 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/server.py +62 -41
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/__init__.py +1 -1
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/client_server.py +8 -2
- fastled-1.2.86/src/fastled/server_flask.py +473 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled.egg-info/PKG-INFO +1 -1
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled.egg-info/SOURCES.txt +1 -0
- {fastled-1.2.83 → fastled-1.2.86}/test +4 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_fetch_source_files.py +12 -1
- fastled-1.2.83/src/fastled/server_flask.py +0 -267
- {fastled-1.2.83 → fastled-1.2.86}/.aiderignore +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.dockerignore +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/lint.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.github/workflows/test_win.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.pylintrc +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.vscode/launch.json +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.vscode/settings.json +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/.vscode/tasks.json +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/Dockerfile +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/LICENSE +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/MANIFEST.in +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/README.md +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/RELEASE.md +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/TODO.md +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/build_exe.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/build_site.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/clean +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/CMakeLists.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/__init__.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/arduino-pre-process.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/build.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/build_archive.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/build_fast.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/code_sync.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/compile.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/compile_lock.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/debug.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/entrypoint.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/extra/100dots.html +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/extra/demo_threejs.html +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/extra/micdemo.html +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/extra/mp3upload.html +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/final_prewarm.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/init_runtime.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/install-arduino-cli.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/libcompile/CMakeLists.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/paths.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/pre-process.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/prewarm.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/process-ino.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/process_extended.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/pyproject.toml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/run.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/sketch_hasher.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/compiler/wasm_compiler_flags.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/docker-compose.yml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/install +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/install_linux.sh +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/lint +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/pyproject.toml +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/requirements.testing.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/setup.cfg +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/setup.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/app.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/assets/example.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/cli.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/cli_test.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/cli_test_interactive.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/compile_server.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/docker_manager.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/filewatcher.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/keyboard.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/keyz.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/live_client.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/open_browser.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/parse_args.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/paths.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/print_filter.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/project_init.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/server_start.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/settings.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/site/build.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/site/examples.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/sketch.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/spinner.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/string_diff.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/test/examples.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/types.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/util.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled/web_compile.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/integration/test_examples.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/html/index.html +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_api.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_bad_ino.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_cli.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_http_server.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_ino/bad/bad.ino +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_print_filter.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_project_init.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_version.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.2.83 → fastled-1.2.86}/upload_package.sh +0 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env -S uv run
|
2
|
+
|
3
|
+
# Requirements:
|
4
|
+
# - python-dateutil
|
5
|
+
|
6
|
+
# pyproject.toml
|
7
|
+
# [project]
|
8
|
+
# dependencies = [
|
9
|
+
# "python-dateutil"
|
10
|
+
# ]
|
11
|
+
|
12
|
+
import os
|
13
|
+
import shutil
|
14
|
+
import subprocess
|
15
|
+
|
16
|
+
def _exec(cmd: str) -> int:
|
17
|
+
print(f"$ {cmd}")
|
18
|
+
return subprocess.call(cmd, shell=True)
|
19
|
+
|
20
|
+
# Step 1: Stop containers and remove images
|
21
|
+
_exec("docker compose down --remove-orphans --rmi all")
|
22
|
+
|
23
|
+
# Step 2: Remove all dangling images
|
24
|
+
_exec("docker image prune -f")
|
25
|
+
|
26
|
+
# Step 3: Remove all images matching niteris/fastled-wasm
|
27
|
+
images = subprocess.check_output(
|
28
|
+
"docker images --format '{{.Repository}} {{.ID}}'",
|
29
|
+
shell=True, text=True
|
30
|
+
)
|
31
|
+
|
32
|
+
for line in images.strip().splitlines():
|
33
|
+
repo, image_id = line.split()
|
34
|
+
if repo == "niteris/fastled-wasm":
|
35
|
+
_exec(f"docker rmi {image_id}")
|
36
|
+
|
37
|
+
# Step 4: Optionally remove volumes
|
38
|
+
# _exec("docker volume prune -f") # Uncomment if you want to purge volumes too
|
39
|
+
|
40
|
+
# Step 5: Remove local build artifacts (e.g., PlatformIO)
|
41
|
+
if os.path.exists("build"):
|
42
|
+
print("Removing local build/ directory")
|
43
|
+
shutil.rmtree("build")
|
44
|
+
|
45
|
+
|
46
|
+
# Step 6: Rebuild images
|
47
|
+
_exec("docker compose build")
|
@@ -431,6 +431,34 @@ def get_settings() -> dict:
|
|
431
431
|
return settings
|
432
432
|
|
433
433
|
|
434
|
+
# Return content and media type
|
435
|
+
def fetch_file(full_path: Path) -> tuple[bytes, str] | HTTPException:
|
436
|
+
"""Fetch the file from the server."""
|
437
|
+
print(f"Fetching file: {full_path}")
|
438
|
+
if not full_path.exists():
|
439
|
+
raise HTTPException(status_code=404, detail="File not found.")
|
440
|
+
if not full_path.is_file():
|
441
|
+
raise HTTPException(status_code=400, detail="Not a file.")
|
442
|
+
if not full_path.is_relative_to(FASTLED_SRC) and not full_path.is_relative_to(
|
443
|
+
"/emsdk"
|
444
|
+
):
|
445
|
+
raise HTTPException(status_code=400, detail="Invalid file path.")
|
446
|
+
|
447
|
+
content = full_path.read_bytes()
|
448
|
+
# Determine media type based on file extension
|
449
|
+
media_type = "text/plain"
|
450
|
+
if full_path.suffix in [".h", ".cpp"]:
|
451
|
+
media_type = "text/plain"
|
452
|
+
elif full_path.suffix == ".html":
|
453
|
+
media_type = "text/html"
|
454
|
+
elif full_path.suffix == ".js":
|
455
|
+
media_type = "application/javascript"
|
456
|
+
elif full_path.suffix == ".css":
|
457
|
+
media_type = "text/css"
|
458
|
+
|
459
|
+
return content, media_type
|
460
|
+
|
461
|
+
|
434
462
|
def startup() -> None:
|
435
463
|
print("Starting FastLED wasm compiler server...")
|
436
464
|
try:
|
@@ -599,37 +627,22 @@ def project_init_example(
|
|
599
627
|
|
600
628
|
|
601
629
|
@app.get("/sourcefiles/{filepath:path}")
|
602
|
-
def source_file(filepath: str) ->
|
630
|
+
def source_file(filepath: str) -> Response:
|
603
631
|
"""Get the source file from the server."""
|
604
632
|
print(f"Endpoint accessed: /sourcefiles/{filepath}")
|
605
633
|
if ".." in filepath:
|
606
634
|
raise HTTPException(status_code=400, detail="Invalid file path.")
|
607
635
|
full_path = Path(FASTLED_SRC / filepath)
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
elif suffix == ".html":
|
619
|
-
media_type = "text/html"
|
620
|
-
elif suffix == ".js":
|
621
|
-
media_type = "application/javascript"
|
622
|
-
elif suffix == ".css":
|
623
|
-
media_type = "text/css"
|
624
|
-
else:
|
625
|
-
media_type = "application/octet-stream"
|
626
|
-
|
627
|
-
fr = FileResponse(
|
628
|
-
path=full_path,
|
629
|
-
media_type=media_type,
|
630
|
-
filename=filepath,
|
631
|
-
)
|
632
|
-
return fr
|
636
|
+
result: tuple[bytes, str] | HTTPException = fetch_file(full_path=full_path)
|
637
|
+
if isinstance(result, HTTPException):
|
638
|
+
assert isinstance(result, HTTPException)
|
639
|
+
return Response(
|
640
|
+
content=result.detail, # type: ignore
|
641
|
+
media_type="text/plain",
|
642
|
+
status_code=result.status_code, # type: ignore
|
643
|
+
)
|
644
|
+
content, media_type = result
|
645
|
+
return Response(content=content, media_type=media_type)
|
633
646
|
|
634
647
|
|
635
648
|
@app.get("/drawfsource/{file_path:path}")
|
@@ -642,21 +655,29 @@ async def static_files(file_path: str) -> Response:
|
|
642
655
|
# Extract the path after "js/fastled/src/"
|
643
656
|
relative_path = file_path[len("js/fastled/src/") :]
|
644
657
|
full_path = FASTLED_SRC / relative_path
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
media_type
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
658
|
+
result: tuple[bytes, str] | HTTPException = fetch_file(full_path=full_path)
|
659
|
+
|
660
|
+
# return Response(content=content, media_type=media_type)
|
661
|
+
if isinstance(result, HTTPException):
|
662
|
+
return Response(
|
663
|
+
content=result.detail, # type: ignore
|
664
|
+
media_type="text/plain",
|
665
|
+
status_code=result.status_code, # type: ignore
|
666
|
+
)
|
667
|
+
content, media_type = result
|
668
|
+
return Response(content=content, media_type=media_type)
|
669
|
+
elif file_path.startswith("js/drawfsource/emsdk/"):
|
670
|
+
relative_path = file_path[len("js/drawfsource/emsdk/") :]
|
671
|
+
full_path = Path("/") / "emsdk" / relative_path
|
672
|
+
result: tuple[bytes, str] | HTTPException = fetch_file(full_path=full_path)
|
673
|
+
if isinstance(result, HTTPException):
|
674
|
+
return Response(
|
675
|
+
content=result.detail, # type: ignore
|
676
|
+
media_type="text/plain",
|
677
|
+
status_code=result.status_code, # type: ignore
|
678
|
+
)
|
679
|
+
content, media_type = result
|
680
|
+
return Response(content=content, media_type=media_type)
|
660
681
|
|
661
682
|
# If file not found or path doesn't match expected format
|
662
683
|
return Response(
|
@@ -14,7 +14,7 @@ from .types import BuildMode, CompileResult, CompileServerError, FileResponse
|
|
14
14
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
15
15
|
# that has any other change in the repo. Please bump the version as the
|
16
16
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
17
|
-
__version__ = "1.2.
|
17
|
+
__version__ = "1.2.86"
|
18
18
|
|
19
19
|
|
20
20
|
class Api:
|
@@ -63,6 +63,12 @@ def TEST_BEFORE_COMPILE(url) -> None:
|
|
63
63
|
pass
|
64
64
|
|
65
65
|
|
66
|
+
def _chunked_print(stdout: str) -> None:
|
67
|
+
lines = stdout.splitlines()
|
68
|
+
for line in lines:
|
69
|
+
print(line)
|
70
|
+
|
71
|
+
|
66
72
|
def _run_web_compiler(
|
67
73
|
directory: Path,
|
68
74
|
host: str,
|
@@ -80,7 +86,7 @@ def _run_web_compiler(
|
|
80
86
|
if not web_result.success:
|
81
87
|
print("\nWeb compilation failed:")
|
82
88
|
print(f"Time taken: {diff:.2f} seconds")
|
83
|
-
|
89
|
+
_chunked_print(web_result.stdout)
|
84
90
|
# Create error page
|
85
91
|
output_dir.mkdir(exist_ok=True)
|
86
92
|
error_html = _create_error_html(web_result.stdout)
|
@@ -117,7 +123,7 @@ def _run_web_compiler(
|
|
117
123
|
# Extract zip contents
|
118
124
|
shutil.unpack_archive(temp_zip, output_dir, "zip")
|
119
125
|
|
120
|
-
|
126
|
+
_chunked_print(web_result.stdout)
|
121
127
|
print_results()
|
122
128
|
return web_result
|
123
129
|
|