fastled 1.1.88__tar.gz → 1.2.2__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.
Files changed (115) hide show
  1. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/build_multi_docker_image.yml +0 -4
  2. {fastled-1.1.88 → fastled-1.2.2}/PKG-INFO +16 -9
  3. {fastled-1.1.88 → fastled-1.2.2}/README.md +15 -8
  4. fastled-1.2.2/RELEASE.md +8 -0
  5. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/__init__.py +46 -3
  6. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/app.py +3 -0
  7. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/compile_server_impl.py +5 -9
  8. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/docker_manager.py +29 -0
  9. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/parse_args.py +15 -2
  10. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/project_init.py +8 -13
  11. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/settings.py +4 -0
  12. fastled-1.2.2/src/fastled/test/can_run_local_docker_tests.py +13 -0
  13. fastled-1.2.2/src/fastled/test/examples.py +49 -0
  14. {fastled-1.1.88 → fastled-1.2.2}/src/fastled.egg-info/PKG-INFO +16 -9
  15. {fastled-1.1.88 → fastled-1.2.2}/src/fastled.egg-info/SOURCES.txt +3 -1
  16. fastled-1.2.2/tests/test_build_examples.py +22 -0
  17. {fastled-1.1.88 → fastled-1.2.2}/tests/test_compile_server.py +4 -12
  18. {fastled-1.1.88 → fastled-1.2.2}/tests/test_embedded_data.py +4 -10
  19. {fastled-1.1.88 → fastled-1.2.2}/tests/test_examples.py +6 -14
  20. {fastled-1.1.88 → fastled-1.2.2}/tests/test_project_init.py +5 -8
  21. {fastled-1.1.88 → fastled-1.2.2}/tests/test_server_and_client_seperatly.py +3 -6
  22. fastled-1.1.88/.github/workflows/check_pfx_b64.yml +0 -28
  23. fastled-1.1.88/src/fastled/test/examples.py +0 -31
  24. {fastled-1.1.88 → fastled-1.2.2}/.aiderignore +0 -0
  25. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/build_webpage.yml +0 -0
  26. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/lint.yml +0 -0
  27. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/publish_release.yml +0 -0
  28. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/test_build_exe.yml +0 -0
  29. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/test_macos.yml +0 -0
  30. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/test_ubuntu.yml +0 -0
  31. {fastled-1.1.88 → fastled-1.2.2}/.github/workflows/test_win.yml +0 -0
  32. {fastled-1.1.88 → fastled-1.2.2}/.gitignore +0 -0
  33. {fastled-1.1.88 → fastled-1.2.2}/.pylintrc +0 -0
  34. {fastled-1.1.88 → fastled-1.2.2}/.vscode/launch.json +0 -0
  35. {fastled-1.1.88 → fastled-1.2.2}/.vscode/settings.json +0 -0
  36. {fastled-1.1.88 → fastled-1.2.2}/.vscode/tasks.json +0 -0
  37. {fastled-1.1.88 → fastled-1.2.2}/LICENSE +0 -0
  38. {fastled-1.1.88 → fastled-1.2.2}/MANIFEST.in +0 -0
  39. {fastled-1.1.88 → fastled-1.2.2}/TODO.md +0 -0
  40. {fastled-1.1.88 → fastled-1.2.2}/build_exe.py +0 -0
  41. {fastled-1.1.88 → fastled-1.2.2}/build_site.py +0 -0
  42. {fastled-1.1.88 → fastled-1.2.2}/clean +0 -0
  43. {fastled-1.1.88 → fastled-1.2.2}/examples/Blink/Blink.ino +0 -0
  44. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/Chromancer.ino +0 -0
  45. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/detail.h +0 -0
  46. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/gary_woos_wled_port/gary_woos_wled_ledmap.h +0 -0
  47. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/gary_woos_wled_port/presets.json +0 -0
  48. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/gary_woos_wled_port/presets.min.json +0 -0
  49. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/gen.py +0 -0
  50. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/mapping.h +0 -0
  51. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/net.h +0 -0
  52. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/output.json +0 -0
  53. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/ripple.h +0 -0
  54. {fastled-1.1.88 → fastled-1.2.2}/examples/Chromancer/screenmap.json.h +0 -0
  55. {fastled-1.1.88 → fastled-1.2.2}/examples/ColorPalette/ColorPalette.ino +0 -0
  56. {fastled-1.1.88 → fastled-1.2.2}/examples/ColorTemperature/ColorTemperature.ino +0 -0
  57. {fastled-1.1.88 → fastled-1.2.2}/examples/Cylon/Cylon.ino +0 -0
  58. {fastled-1.1.88 → fastled-1.2.2}/examples/DemoReel100/DemoReel100.ino +0 -0
  59. {fastled-1.1.88 → fastled-1.2.2}/examples/Esp32Rmt51/Esp32Rmt51.ino +0 -0
  60. {fastled-1.1.88 → fastled-1.2.2}/examples/EspI2SDemo/EspI2SDemo.ino +0 -0
  61. {fastled-1.1.88 → fastled-1.2.2}/examples/Fire2012/Fire2012.ino +0 -0
  62. {fastled-1.1.88 → fastled-1.2.2}/examples/Fire2012WithPalette/Fire2012WithPalette.ino +0 -0
  63. {fastled-1.1.88 → fastled-1.2.2}/examples/FirstLight/FirstLight.ino +0 -0
  64. {fastled-1.1.88 → fastled-1.2.2}/examples/FxEngine/FxEngine.ino +0 -0
  65. {fastled-1.1.88 → fastled-1.2.2}/examples/Noise/Noise.ino +0 -0
  66. {fastled-1.1.88 → fastled-1.2.2}/examples/NoisePlayground/NoisePlayground.ino +0 -0
  67. {fastled-1.1.88 → fastled-1.2.2}/examples/NoisePlusPalette/NoisePlusPalette.ino +0 -0
  68. {fastled-1.1.88 → fastled-1.2.2}/examples/OctoWS2811/OctoWS2811.ino +0 -0
  69. {fastled-1.1.88 → fastled-1.2.2}/examples/Pacifica/Pacifica.ino +0 -0
  70. {fastled-1.1.88 → fastled-1.2.2}/examples/Pride2015/Pride2015.ino +0 -0
  71. {fastled-1.1.88 → fastled-1.2.2}/examples/TwinkleFox/TwinkleFox.ino +0 -0
  72. {fastled-1.1.88 → fastled-1.2.2}/examples/Video/Gfx2Video/Gfx2Video.ino +0 -0
  73. {fastled-1.1.88 → fastled-1.2.2}/examples/WasmScreenCoords/WasmScreenCoords.ino +0 -0
  74. {fastled-1.1.88 → fastled-1.2.2}/examples/Water/Water.ino +0 -0
  75. {fastled-1.1.88 → fastled-1.2.2}/examples/XYMatrix/XYMatrix.ino +0 -0
  76. {fastled-1.1.88 → fastled-1.2.2}/examples/wasm/wasm.ino +0 -0
  77. {fastled-1.1.88 → fastled-1.2.2}/install +0 -0
  78. {fastled-1.1.88 → fastled-1.2.2}/lint +0 -0
  79. {fastled-1.1.88 → fastled-1.2.2}/pyproject.toml +0 -0
  80. {fastled-1.1.88 → fastled-1.2.2}/requirements.testing.txt +0 -0
  81. {fastled-1.1.88 → fastled-1.2.2}/setup.cfg +0 -0
  82. {fastled-1.1.88 → fastled-1.2.2}/setup.py +0 -0
  83. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/assets/example.txt +0 -0
  84. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/cli.py +0 -0
  85. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/client_server.py +0 -0
  86. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/compile_server.py +0 -0
  87. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/filewatcher.py +0 -0
  88. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/keyboard.py +0 -0
  89. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/live_client.py +0 -0
  90. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/open_browser.py +0 -0
  91. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/paths.py +0 -0
  92. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/select_sketch_directory.py +0 -0
  93. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/site/build.py +0 -0
  94. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/sketch.py +0 -0
  95. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/spinner.py +0 -0
  96. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/string_diff.py +0 -0
  97. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/types.py +0 -0
  98. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/util.py +0 -0
  99. {fastled-1.1.88 → fastled-1.2.2}/src/fastled/web_compile.py +0 -0
  100. {fastled-1.1.88 → fastled-1.2.2}/src/fastled.egg-info/dependency_links.txt +0 -0
  101. {fastled-1.1.88 → fastled-1.2.2}/src/fastled.egg-info/entry_points.txt +0 -0
  102. {fastled-1.1.88 → fastled-1.2.2}/src/fastled.egg-info/requires.txt +0 -0
  103. {fastled-1.1.88 → fastled-1.2.2}/src/fastled.egg-info/top_level.txt +0 -0
  104. {fastled-1.1.88 → fastled-1.2.2}/test +0 -0
  105. {fastled-1.1.88 → fastled-1.2.2}/tests/test_api.py +0 -0
  106. {fastled-1.1.88 → fastled-1.2.2}/tests/test_bad_ino.py +0 -0
  107. {fastled-1.1.88 → fastled-1.2.2}/tests/test_cli.py +0 -0
  108. {fastled-1.1.88 → fastled-1.2.2}/tests/test_docker_linux_on_windows.py +0 -0
  109. {fastled-1.1.88 → fastled-1.2.2}/tests/test_filechanger.py +0 -0
  110. {fastled-1.1.88 → fastled-1.2.2}/tests/test_ino/bad/bad.ino +0 -0
  111. {fastled-1.1.88 → fastled-1.2.2}/tests/test_ino/embedded/data/bigdata.dat +0 -0
  112. {fastled-1.1.88 → fastled-1.2.2}/tests/test_ino/embedded/wasm.ino +0 -0
  113. {fastled-1.1.88 → fastled-1.2.2}/tests/test_ino/wasm/wasm.ino +0 -0
  114. {fastled-1.1.88 → fastled-1.2.2}/tests/test_webcompile.py +0 -0
  115. {fastled-1.1.88 → fastled-1.2.2}/upload_package.sh +0 -0
@@ -135,8 +135,4 @@ jobs:
135
135
  - name: Inspect image
136
136
  run: |
137
137
  docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
138
-
139
- - name: Redeploy FastLED web service
140
- run: |
141
- curl ${{ secrets.FASTLED_REDEPLOY_URL }}
142
138
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.88
3
+ Version: 1.2.2
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -23,9 +23,6 @@ Requires-Dist: progress>=1.6
23
23
 
24
24
  # FastLED Wasm compiler
25
25
 
26
- Compiles an Arduino/Platformio sketch into a wasm binary that can be run directly in the web browser.
27
-
28
-
29
26
  [![Linting](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml)
30
27
  [![MacOS_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_macos.yml)
31
28
  [![Ubuntu_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_ubuntu.yml)
@@ -35,9 +32,11 @@ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directl
35
32
  [![Build Executables](https://github.com/zackees/fastled-wasm/actions/workflows/test_build_exe.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_build_exe.yml)
36
33
  [![Publish Release](https://github.com/zackees/fastled-wasm/actions/workflows/publish_release.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/publish_release.yml)
37
34
 
38
- # Demo
39
35
 
40
- https://zackees.github.io/fastled-wasm/
36
+
37
+ ## Compile your FastLED sketch and run it on the Browser!
38
+
39
+ ![image](https://github.com/user-attachments/assets/243aeb4d-e42f-4cc3-9c31-0af51271f3e0)
41
40
 
42
41
 
43
42
  # About
@@ -46,11 +45,17 @@ This python app will compile your FastLED style sketches into html/js/wasm outpu
46
45
 
47
46
  Compile times are extremely fast, thanks to aggressive object caching for C++ and sketch fingerprinting with a zip file cache. Recompilation of sketch files with minimal changes will occure in less than a second.
48
47
 
49
- By default the web compiler will always be used unless that user specifies `--local`, in which case this compiler will invoke docker to bring in a runtime necessary to run the compiler toolchain.
48
+ If you have docker installed, the compiler will download the docker image and run a private local server on your machine. If you don't have Docker installed then the app will fall back to using the public web compiler.
49
+
50
+ In every conceivable way, the local compiler will be much faster than the web version.
51
+
52
+ # Demo
53
+
54
+ https://zackees.github.io/fastled-wasm/
50
55
 
51
- The local compiler will be much faster than the web version in most circumstances after the first compile. The web compiler
52
- has the advantage that as a persistant service the compile cache will remain much more up to date.
56
+ # Tutorial video
53
57
 
58
+ **Note this video is a little outdated, you will install the app now with `pip install fastled` and run it like `fastled mysketchfolder`**
54
59
 
55
60
  https://github.com/user-attachments/assets/64ae0e6c-5f8b-4830-ab87-dcc25bc61218
56
61
 
@@ -260,6 +265,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
260
265
 
261
266
  # Revisions
262
267
 
268
+ * 1.2.22 - Added `--purge` and added docker api at __init__.
269
+ * 1.2.00 - `fastled.exe` is now a signed binary on windows, however it's a self signed binary so you'll still get the warning on the first open. There's been a small api change between the server and the client for fetching projects.
263
270
  * 1.1.69 - Changed the binary name to `fastled.exe` instead of something like `fastled-windows-x64.exe`
264
271
  * 1.1.68 - Add a site builder to fastled.Test which generates a website with a bunch of demos. This is used to build the demo site automatically.
265
272
  * 1.1.67 - Pinned all the minimum versions of dependencies so we don't bind to an out of date py dep: https://github.com/zackees/fastled-wasm/issues/3
@@ -1,8 +1,5 @@
1
1
  # FastLED Wasm compiler
2
2
 
3
- Compiles an Arduino/Platformio sketch into a wasm binary that can be run directly in the web browser.
4
-
5
-
6
3
  [![Linting](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml)
7
4
  [![MacOS_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_macos.yml)
8
5
  [![Ubuntu_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_ubuntu.yml)
@@ -12,9 +9,11 @@ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directl
12
9
  [![Build Executables](https://github.com/zackees/fastled-wasm/actions/workflows/test_build_exe.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_build_exe.yml)
13
10
  [![Publish Release](https://github.com/zackees/fastled-wasm/actions/workflows/publish_release.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/publish_release.yml)
14
11
 
15
- # Demo
16
12
 
17
- https://zackees.github.io/fastled-wasm/
13
+
14
+ ## Compile your FastLED sketch and run it on the Browser!
15
+
16
+ ![image](https://github.com/user-attachments/assets/243aeb4d-e42f-4cc3-9c31-0af51271f3e0)
18
17
 
19
18
 
20
19
  # About
@@ -23,11 +22,17 @@ This python app will compile your FastLED style sketches into html/js/wasm outpu
23
22
 
24
23
  Compile times are extremely fast, thanks to aggressive object caching for C++ and sketch fingerprinting with a zip file cache. Recompilation of sketch files with minimal changes will occure in less than a second.
25
24
 
26
- By default the web compiler will always be used unless that user specifies `--local`, in which case this compiler will invoke docker to bring in a runtime necessary to run the compiler toolchain.
25
+ If you have docker installed, the compiler will download the docker image and run a private local server on your machine. If you don't have Docker installed then the app will fall back to using the public web compiler.
26
+
27
+ In every conceivable way, the local compiler will be much faster than the web version.
28
+
29
+ # Demo
30
+
31
+ https://zackees.github.io/fastled-wasm/
27
32
 
28
- The local compiler will be much faster than the web version in most circumstances after the first compile. The web compiler
29
- has the advantage that as a persistant service the compile cache will remain much more up to date.
33
+ # Tutorial video
30
34
 
35
+ **Note this video is a little outdated, you will install the app now with `pip install fastled` and run it like `fastled mysketchfolder`**
31
36
 
32
37
  https://github.com/user-attachments/assets/64ae0e6c-5f8b-4830-ab87-dcc25bc61218
33
38
 
@@ -237,6 +242,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
237
242
 
238
243
  # Revisions
239
244
 
245
+ * 1.2.22 - Added `--purge` and added docker api at __init__.
246
+ * 1.2.00 - `fastled.exe` is now a signed binary on windows, however it's a self signed binary so you'll still get the warning on the first open. There's been a small api change between the server and the client for fetching projects.
240
247
  * 1.1.69 - Changed the binary name to `fastled.exe` instead of something like `fastled-windows-x64.exe`
241
248
  * 1.1.68 - Add a site builder to fastled.Test which generates a website with a bunch of demos. This is used to build the demo site automatically.
242
249
  * 1.1.67 - Pinned all the minimum versions of dependencies so we don't bind to an out of date py dep: https://github.com/zackees/fastled-wasm/issues/3
@@ -0,0 +1,8 @@
1
+ # How to do a release.
2
+
3
+ Go to src/fastled/__init__.py and increase the version number.
4
+
5
+ Make sure this is the ONLY change in your repo (or the release will fail
6
+ for unknown reasons) and commit and then push. Github builders will do all the rest.
7
+
8
+ Make sure and watch the jobs to verify that it worked.
@@ -13,15 +13,18 @@ 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.1.88"
16
+ __version__ = "1.2.2"
17
17
 
18
18
 
19
19
  class Api:
20
20
  @staticmethod
21
- def get_examples():
21
+ def get_examples(host: str | CompileServer | None = None) -> list[str]:
22
22
  from fastled.project_init import get_examples
23
23
 
24
- return get_examples()
24
+ if isinstance(host, CompileServer):
25
+ host = host.url()
26
+
27
+ return get_examples(host=host)
25
28
 
26
29
  @staticmethod
27
30
  def project_init(
@@ -109,7 +112,47 @@ class Api:
109
112
  server.stop()
110
113
 
111
114
 
115
+ class Docker:
116
+ @staticmethod
117
+ def is_installed() -> bool:
118
+ from fastled.docker_manager import DockerManager
119
+
120
+ return DockerManager.is_docker_installed()
121
+
122
+ @staticmethod
123
+ def is_running() -> bool:
124
+ from fastled.docker_manager import DockerManager
125
+
126
+ return DockerManager.is_running()
127
+
128
+ @staticmethod
129
+ def is_container_running(container_name: str | None = None) -> bool:
130
+ # from fastled.docker import is_container_running
131
+ from fastled.docker_manager import DockerManager
132
+ from fastled.settings import CONTAINER_NAME
133
+
134
+ docker = DockerManager()
135
+ container_name = container_name or CONTAINER_NAME
136
+ return docker.is_container_running(container_name)
137
+
138
+ @staticmethod
139
+ def purge() -> None:
140
+ from fastled.docker_manager import DockerManager
141
+ from fastled.settings import CONTAINER_NAME
142
+
143
+ docker = DockerManager()
144
+ docker.purge(CONTAINER_NAME)
145
+
146
+
112
147
  class Test:
148
+ __test__ = False # This prevents unittest from recognizing it as a test class.
149
+
150
+ @staticmethod
151
+ def can_run_local_docker_tests() -> bool:
152
+ from fastled.test.can_run_local_docker_tests import can_run_local_docker_tests
153
+
154
+ return can_run_local_docker_tests()
155
+
113
156
  @staticmethod
114
157
  def test_examples(
115
158
  examples: list[str] | None = None, host: str | CompileServer | None = None
@@ -16,6 +16,9 @@ def run_server(args: argparse.Namespace) -> int:
16
16
  interactive = args.interactive
17
17
  auto_update = args.auto_update
18
18
  mapped_dir = Path(args.directory).absolute() if args.directory else None
19
+ if interactive and mapped_dir is None:
20
+ print("Select a sketch when you enter interactive mode.")
21
+ return 1
19
22
  compile_server = CompileServer(
20
23
  interactive=interactive,
21
24
  auto_updates=auto_update,
@@ -12,14 +12,10 @@ from fastled.docker_manager import (
12
12
  DockerManager,
13
13
  RunningContainer,
14
14
  )
15
- from fastled.settings import SERVER_PORT
15
+ from fastled.settings import DEFAULT_CONTAINER_NAME, IMAGE_NAME, SERVER_PORT
16
16
  from fastled.sketch import looks_like_fastled_repo
17
17
  from fastled.types import BuildMode, CompileResult, CompileServerError
18
18
 
19
- _IMAGE_NAME = "niteris/fastled-wasm"
20
- _DEFAULT_CONTAINER_NAME = "fastled-wasm-compiler"
21
-
22
-
23
19
  SERVER_OPTIONS = [
24
20
  "--allow-shutdown", # Allow the server to be shut down without a force kill.
25
21
  "--no-auto-update", # Don't auto live updates from the git repo.
@@ -46,7 +42,7 @@ class CompileServerImpl:
46
42
  auto_start: bool = True,
47
43
  container_name: str | None = None,
48
44
  ) -> None:
49
- container_name = container_name or _DEFAULT_CONTAINER_NAME
45
+ container_name = container_name or DEFAULT_CONTAINER_NAME
50
46
  if interactive and not mapped_dir:
51
47
  raise ValueError(
52
48
  "Interactive mode requires a mapped directory point to a sketch"
@@ -178,7 +174,7 @@ class CompileServerImpl:
178
174
  else:
179
175
  upgrade = self.auto_updates
180
176
  self.docker.validate_or_download_image(
181
- image_name=_IMAGE_NAME, tag="main", upgrade=upgrade
177
+ image_name=IMAGE_NAME, tag="main", upgrade=upgrade
182
178
  )
183
179
  DISK_CACHE.put("last-update", now_str)
184
180
 
@@ -214,7 +210,7 @@ class CompileServerImpl:
214
210
  cmd_str = subprocess.list2cmdline(server_command)
215
211
  if not self.interactive:
216
212
  container: Container = self.docker.run_container_detached(
217
- image_name=_IMAGE_NAME,
213
+ image_name=IMAGE_NAME,
218
214
  tag="main",
219
215
  container_name=self.container_name,
220
216
  command=cmd_str,
@@ -228,7 +224,7 @@ class CompileServerImpl:
228
224
  return port
229
225
  else:
230
226
  self.docker.run_container_interactive(
231
- image_name=_IMAGE_NAME,
227
+ image_name=IMAGE_NAME,
232
228
  tag="main",
233
229
  container_name=self.container_name,
234
230
  command=cmd_str,
@@ -610,6 +610,35 @@ class DockerManager:
610
610
  print(f"Container {container_name} not found.")
611
611
  return False
612
612
 
613
+ def purge(self, image_name: str) -> None:
614
+ """
615
+ Remove all containers and images associated with the given image name.
616
+
617
+ Args:
618
+ image_name: The name of the image to purge (without tag)
619
+ """
620
+ print(f"Purging all containers and images for {image_name}...")
621
+
622
+ # Remove all containers using this image
623
+ try:
624
+ containers = self.client.containers.list(all=True)
625
+ for container in containers:
626
+ if any(image_name in tag for tag in container.image.tags):
627
+ print(f"Removing container {container.name}")
628
+ container.remove(force=True)
629
+ except Exception as e:
630
+ print(f"Error removing containers: {e}")
631
+
632
+ # Remove all images with this name
633
+ try:
634
+ images = self.client.images.list()
635
+ for image in images:
636
+ if any(image_name in tag for tag in image.tags):
637
+ print(f"Removing image {image.tags}")
638
+ self.client.images.remove(image.id, force=True)
639
+ except Exception as e:
640
+ print(f"Error removing images: {e}")
641
+
613
642
 
614
643
  def main():
615
644
  # Register SIGINT handler
@@ -4,10 +4,9 @@ import sys
4
4
  from pathlib import Path
5
5
 
6
6
  from fastled import __version__
7
- from fastled.docker_manager import DockerManager
8
7
  from fastled.project_init import project_init
9
8
  from fastled.select_sketch_directory import select_sketch_directory
10
- from fastled.settings import DEFAULT_URL
9
+ from fastled.settings import DEFAULT_URL, IMAGE_NAME
11
10
  from fastled.sketch import (
12
11
  find_sketch_directories,
13
12
  looks_like_fastled_repo,
@@ -86,6 +85,11 @@ def parse_args() -> argparse.Namespace:
86
85
  action="store_true",
87
86
  help="Run the server in the current directory, volume mapping fastled if we are in the repo",
88
87
  )
88
+ parser.add_argument(
89
+ "--purge",
90
+ action="store_true",
91
+ help="Remove all FastLED containers and images",
92
+ )
89
93
 
90
94
  build_mode = parser.add_mutually_exclusive_group()
91
95
  build_mode.add_argument("--debug", action="store_true", help="Build in debug mode")
@@ -103,6 +107,13 @@ def parse_args() -> argparse.Namespace:
103
107
 
104
108
  args = parser.parse_args()
105
109
 
110
+ if args.purge:
111
+ from fastled.docker_manager import DockerManager
112
+
113
+ docker = DockerManager()
114
+ docker.purge(IMAGE_NAME)
115
+ sys.exit(0)
116
+
106
117
  if args.init:
107
118
  example = args.init if args.init is not True else None
108
119
  args.directory = project_init(example, args.directory)
@@ -122,6 +133,8 @@ def parse_args() -> argparse.Namespace:
122
133
  and not args.web
123
134
  and not args.server
124
135
  ):
136
+ from fastled.docker_manager import DockerManager
137
+
125
138
  if DockerManager.is_docker_installed():
126
139
  if not DockerManager.ensure_linux_containers_for_windows():
127
140
  print(
@@ -5,22 +5,15 @@ import httpx
5
5
 
6
6
  from fastled.settings import DEFAULT_URL
7
7
 
8
- ENDPOINT_PROJECT_INIT = f"{DEFAULT_URL}/project/init"
9
- ENDPOINT_INFO = f"{DEFAULT_URL}/info"
10
8
  DEFAULT_EXAMPLE = "wasm"
11
9
 
12
- _EXCLUDED_EXAMPLES = [
13
- "Pintest",
14
- "OctoWS2811",
15
- ]
16
10
 
17
-
18
- def get_examples() -> list[str]:
19
- response = httpx.get(ENDPOINT_INFO, timeout=4)
11
+ def get_examples(host: str | None = None) -> list[str]:
12
+ host = host or DEFAULT_URL
13
+ url_info = f"{host}/info"
14
+ response = httpx.get(url_info, timeout=4)
20
15
  response.raise_for_status()
21
16
  examples: list[str] = response.json()["examples"]
22
- # filter out excluded examples
23
- examples = [example for example in examples if example not in _EXCLUDED_EXAMPLES]
24
17
  return sorted(examples)
25
18
 
26
19
 
@@ -61,8 +54,9 @@ def project_init(
61
54
  )
62
55
  example = DEFAULT_EXAMPLE
63
56
  assert example is not None
64
- endpoint_url = f"{host}/project/init/{example}"
65
- response = httpx.get(endpoint_url, timeout=20)
57
+ endpoint_url = f"{host}/project/init"
58
+ json = example
59
+ response = httpx.post(endpoint_url, timeout=20, json=json)
66
60
  response.raise_for_status()
67
61
  content = response.content
68
62
  tmpzip = outputdir / "fastled.zip"
@@ -72,6 +66,7 @@ def project_init(
72
66
  zip_ref.extractall(outputdir)
73
67
  tmpzip.unlink()
74
68
  out = outputdir / example
69
+ print(f"Project initialized at {out}")
75
70
  assert out.exists()
76
71
  return out
77
72
 
@@ -7,3 +7,7 @@ PLATFORM_TAG: str = "-arm64" if IS_ARM else ""
7
7
  CONTAINER_NAME = f"fastled-wasm-compiler{PLATFORM_TAG}"
8
8
  DEFAULT_URL = str(os.environ.get("FASTLED_URL", "https://fastled.onrender.com"))
9
9
  SERVER_PORT = 9021
10
+
11
+ IMAGE_NAME = "niteris/fastled-wasm"
12
+ DEFAULT_CONTAINER_NAME = "fastled-wasm-compiler"
13
+ # IMAGE_TAG = "main"
@@ -0,0 +1,13 @@
1
+ import os
2
+ import platform
3
+
4
+
5
+ def can_run_local_docker_tests() -> bool:
6
+ """Check if this system can run Docker Tests"""
7
+ is_github_runner = "GITHUB_ACTIONS" in os.environ
8
+ if not is_github_runner:
9
+ from fastled.docker_manager import DockerManager
10
+
11
+ return DockerManager.is_docker_installed()
12
+ # this only works in ubuntu at the moment
13
+ return platform.system() == "Linux"
@@ -0,0 +1,49 @@
1
+ from tempfile import TemporaryDirectory
2
+ from time import time
3
+ from warnings import warn
4
+
5
+ _FILTER = True
6
+
7
+
8
+ def test_examples(
9
+ examples: list[str] | None = None, host: str | None = None
10
+ ) -> dict[str, Exception]:
11
+ """Test the examples in the given directory."""
12
+ from fastled import Api
13
+
14
+ out: dict[str, Exception] = {}
15
+ examples = Api.get_examples(host=host) if examples is None else examples
16
+ if host is None and _FILTER:
17
+ examples.remove("Chromancer") # Brutal
18
+ examples.remove("LuminescentGrand")
19
+ with TemporaryDirectory() as tmpdir:
20
+ for example in examples:
21
+ print(f"Initializing example: {example}")
22
+ try:
23
+ sketch_dir = Api.project_init(example, outputdir=tmpdir, host=host)
24
+ except Exception as e:
25
+ warn(f"Failed to initialize example: {example}, error: {e}")
26
+ out[example] = e
27
+ continue
28
+ print(f"Project initialized at: {sketch_dir}")
29
+ start = time()
30
+ print(f"Compiling example: {example}")
31
+ diff = time() - start
32
+ print(f"Compilation took: {diff:.2f} seconds")
33
+ result = Api.web_compile(sketch_dir, host=host)
34
+ if not result.success:
35
+ out[example] = Exception(result.stdout)
36
+ return out
37
+
38
+
39
+ def unit_test() -> None:
40
+ from fastled import Api
41
+
42
+ with Api.server(auto_updates=True) as server:
43
+ out = test_examples(host=server.url())
44
+ if out:
45
+ raise RuntimeError(f"Failed tests: {out}")
46
+
47
+
48
+ if __name__ == "__main__":
49
+ unit_test()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.88
3
+ Version: 1.2.2
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -23,9 +23,6 @@ Requires-Dist: progress>=1.6
23
23
 
24
24
  # FastLED Wasm compiler
25
25
 
26
- Compiles an Arduino/Platformio sketch into a wasm binary that can be run directly in the web browser.
27
-
28
-
29
26
  [![Linting](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml)
30
27
  [![MacOS_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_macos.yml)
31
28
  [![Ubuntu_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_ubuntu.yml)
@@ -35,9 +32,11 @@ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directl
35
32
  [![Build Executables](https://github.com/zackees/fastled-wasm/actions/workflows/test_build_exe.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_build_exe.yml)
36
33
  [![Publish Release](https://github.com/zackees/fastled-wasm/actions/workflows/publish_release.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/publish_release.yml)
37
34
 
38
- # Demo
39
35
 
40
- https://zackees.github.io/fastled-wasm/
36
+
37
+ ## Compile your FastLED sketch and run it on the Browser!
38
+
39
+ ![image](https://github.com/user-attachments/assets/243aeb4d-e42f-4cc3-9c31-0af51271f3e0)
41
40
 
42
41
 
43
42
  # About
@@ -46,11 +45,17 @@ This python app will compile your FastLED style sketches into html/js/wasm outpu
46
45
 
47
46
  Compile times are extremely fast, thanks to aggressive object caching for C++ and sketch fingerprinting with a zip file cache. Recompilation of sketch files with minimal changes will occure in less than a second.
48
47
 
49
- By default the web compiler will always be used unless that user specifies `--local`, in which case this compiler will invoke docker to bring in a runtime necessary to run the compiler toolchain.
48
+ If you have docker installed, the compiler will download the docker image and run a private local server on your machine. If you don't have Docker installed then the app will fall back to using the public web compiler.
49
+
50
+ In every conceivable way, the local compiler will be much faster than the web version.
51
+
52
+ # Demo
53
+
54
+ https://zackees.github.io/fastled-wasm/
50
55
 
51
- The local compiler will be much faster than the web version in most circumstances after the first compile. The web compiler
52
- has the advantage that as a persistant service the compile cache will remain much more up to date.
56
+ # Tutorial video
53
57
 
58
+ **Note this video is a little outdated, you will install the app now with `pip install fastled` and run it like `fastled mysketchfolder`**
54
59
 
55
60
  https://github.com/user-attachments/assets/64ae0e6c-5f8b-4830-ab87-dcc25bc61218
56
61
 
@@ -260,6 +265,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
260
265
 
261
266
  # Revisions
262
267
 
268
+ * 1.2.22 - Added `--purge` and added docker api at __init__.
269
+ * 1.2.00 - `fastled.exe` is now a signed binary on windows, however it's a self signed binary so you'll still get the warning on the first open. There's been a small api change between the server and the client for fetching projects.
263
270
  * 1.1.69 - Changed the binary name to `fastled.exe` instead of something like `fastled-windows-x64.exe`
264
271
  * 1.1.68 - Add a site builder to fastled.Test which generates a website with a bunch of demos. This is used to build the demo site automatically.
265
272
  * 1.1.67 - Pinned all the minimum versions of dependencies so we don't bind to an out of date py dep: https://github.com/zackees/fastled-wasm/issues/3
@@ -4,6 +4,7 @@
4
4
  LICENSE
5
5
  MANIFEST.in
6
6
  README.md
7
+ RELEASE.md
7
8
  TODO.md
8
9
  build_exe.py
9
10
  build_site.py
@@ -17,7 +18,6 @@ test
17
18
  upload_package.sh
18
19
  .github/workflows/build_multi_docker_image.yml
19
20
  .github/workflows/build_webpage.yml
20
- .github/workflows/check_pfx_b64.yml
21
21
  .github/workflows/lint.yml
22
22
  .github/workflows/publish_release.yml
23
23
  .github/workflows/test_build_exe.yml
@@ -91,9 +91,11 @@ src/fastled.egg-info/requires.txt
91
91
  src/fastled.egg-info/top_level.txt
92
92
  src/fastled/assets/example.txt
93
93
  src/fastled/site/build.py
94
+ src/fastled/test/can_run_local_docker_tests.py
94
95
  src/fastled/test/examples.py
95
96
  tests/test_api.py
96
97
  tests/test_bad_ino.py
98
+ tests/test_build_examples.py
97
99
  tests/test_cli.py
98
100
  tests/test_compile_server.py
99
101
  tests/test_docker_linux_on_windows.py
@@ -0,0 +1,22 @@
1
+ """
2
+ Unit test file.
3
+ """
4
+
5
+ import unittest
6
+
7
+ from fastled import Api, Test # type: ignore
8
+
9
+
10
+ class ApiTester(unittest.TestCase):
11
+ """Main tester class."""
12
+
13
+ def test_build_all_examples(self) -> None:
14
+ """Test command line interface (CLI)."""
15
+
16
+ with Api.server(auto_updates=True) as server:
17
+ out = Test.test_examples(host=server)
18
+ self.assertEqual(0, len(out), f"Failed tests: {out}")
19
+
20
+
21
+ if __name__ == "__main__":
22
+ unittest.main()
@@ -1,8 +1,7 @@
1
- import os
2
- import platform
3
1
  import unittest
4
2
  from pathlib import Path
5
3
 
4
+ from fastled import Test
6
5
  from fastled.compile_server import CompileServer
7
6
  from fastled.web_compile import CompileResult
8
7
 
@@ -10,19 +9,12 @@ HERE = Path(__file__).parent
10
9
  TEST_DIR = HERE / "test_ino" / "wasm"
11
10
 
12
11
 
13
- def _enabled() -> bool:
14
- """Check if this system can run the tests."""
15
- is_github_runner = "GITHUB_ACTIONS" in os.environ
16
- if not is_github_runner:
17
- return True
18
- # this only works in ubuntu at the moment
19
- return platform.system() == "Linux"
20
-
21
-
22
12
  class WebCompilerTester(unittest.TestCase):
23
13
  """Main tester class."""
24
14
 
25
- @unittest.skipUnless(_enabled(), "Skipping test on non-Linux system on github")
15
+ @unittest.skipUnless(
16
+ Test.can_run_local_docker_tests(), "Skipping test on non-Linux system on github"
17
+ )
26
18
  def test_server(self) -> None:
27
19
  """Test basic server start/stop functionality."""
28
20
  server = CompileServer(auto_start=True)
@@ -1,12 +1,10 @@
1
- import os
2
- import platform
3
1
  import unittest
4
2
  import zipfile
5
3
  from pathlib import Path
6
4
  from tempfile import TemporaryDirectory
7
5
 
8
6
  from fastled.compile_server import CompileServer
9
- from fastled.web_compile import ENABLE_EMBEDDED_DATA, CompileResult
7
+ from fastled.web_compile import CompileResult
10
8
 
11
9
  HERE = Path(__file__).parent
12
10
  TEST_DIR = HERE / "test_ino" / "embedded"
@@ -14,13 +12,9 @@ TEST_DIR = HERE / "test_ino" / "embedded"
14
12
 
15
13
  def _enabled() -> bool:
16
14
  """Check if this system can run the tests."""
17
- if not ENABLE_EMBEDDED_DATA:
18
- return False
19
- is_github_runner = "GITHUB_ACTIONS" in os.environ
20
- if not is_github_runner:
21
- return True
22
- # this only works in ubuntu at the moment
23
- return platform.system() == "Linux"
15
+ from fastled import Test
16
+
17
+ return Test.can_run_local_docker_tests()
24
18
 
25
19
 
26
20
  class WebCompilerTester(unittest.TestCase):
@@ -1,5 +1,3 @@
1
- import os
2
- import platform
3
1
  import unittest
4
2
  from pathlib import Path
5
3
  from tempfile import TemporaryDirectory
@@ -12,21 +10,14 @@ HERE = Path(__file__).parent
12
10
  TEST_DIR = HERE / "test_ino" / "wasm"
13
11
 
14
12
 
15
- EXAMPLES = [
16
- "Blink",
17
- "wasm",
18
- "Chromancer",
19
- "SdCard",
20
- ]
13
+ EXAMPLES = ["Blink", "wasm", "Chromancer", "fx/SdCard", "fx/NoiseRing"]
21
14
 
22
15
 
23
16
  def _enabled() -> bool:
24
17
  """Check if this system can run the tests."""
25
- is_github_runner = "GITHUB_ACTIONS" in os.environ
26
- if not is_github_runner:
27
- return True
28
- # this only works in ubuntu at the moment
29
- return platform.system() == "Linux"
18
+ from fastled import Test
19
+
20
+ return Test.can_run_local_docker_tests()
30
21
 
31
22
 
32
23
  class WebCompileTester(unittest.TestCase):
@@ -44,7 +35,8 @@ class WebCompileTester(unittest.TestCase):
44
35
  # print out everything in the out dir
45
36
  for f in out.iterdir():
46
37
  print(f)
47
- self.assertTrue((out / example / f"{example}.ino").exists())
38
+ name = Path(example).name
39
+ self.assertTrue((out / example / f"{name}.ino").exists())
48
40
  # Test the web_compile function with actual server call
49
41
  result: CompileResult = server.web_compile(out / example)
50
42
  self.assertTrue(
@@ -1,5 +1,3 @@
1
- import os
2
- import platform
3
1
  import unittest
4
2
  from pathlib import Path
5
3
  from tempfile import TemporaryDirectory
@@ -13,11 +11,9 @@ TEST_DIR = HERE / "test_ino" / "wasm"
13
11
 
14
12
  def _enabled() -> bool:
15
13
  """Check if this system can run the tests."""
16
- is_github_runner = "GITHUB_ACTIONS" in os.environ
17
- if not is_github_runner:
18
- return True
19
- # this only works in ubuntu at the moment
20
- return platform.system() == "Linux"
14
+ from fastled import Test
15
+
16
+ return Test.can_run_local_docker_tests()
21
17
 
22
18
 
23
19
  class ProjectInitTester(unittest.TestCase):
@@ -25,7 +21,8 @@ class ProjectInitTester(unittest.TestCase):
25
21
 
26
22
  def test_get_examples(self) -> None:
27
23
  """Test get_examples function."""
28
- examples = get_examples()
24
+ with Api.server(auto_updates=True) as server:
25
+ examples = get_examples(server.url())
29
26
  self.assertTrue(len(examples) > 0)
30
27
  self.assertTrue("wasm" in examples)
31
28
 
@@ -1,5 +1,4 @@
1
1
  import os
2
- import platform
3
2
  import unittest
4
3
  from pathlib import Path
5
4
 
@@ -12,11 +11,9 @@ CLIENT_CMD = f"fastled --just-compile --localhost {TEST_DIR}"
12
11
 
13
12
  def _enabled() -> bool:
14
13
  """Check if this system can run the tests."""
15
- is_github_runner = "GITHUB_ACTIONS" in os.environ
16
- if not is_github_runner:
17
- return True
18
- # this only works in ubuntu at the moment
19
- return platform.system() == "Linux"
14
+ from fastled import Test
15
+
16
+ return Test.can_run_local_docker_tests()
20
17
 
21
18
 
22
19
  class ServerLocalClientTester(unittest.TestCase):
@@ -1,28 +0,0 @@
1
- name: Check PFX B64
2
-
3
-
4
- on: [push]
5
-
6
- jobs:
7
- build:
8
- runs-on: ${{ matrix.os }}
9
- strategy:
10
- matrix:
11
- os: [
12
- ubuntu-24.04, # linux/amd64
13
- windows-latest, # x64
14
- macos-latest, # arm64
15
- macos-13 # x86
16
- ]
17
- python-version: [3.11]
18
-
19
- steps:
20
- - uses: actions/checkout@v4
21
-
22
- - uses: actions/setup-python@v5
23
- with:
24
- python-version: ${{ matrix.python-version }}
25
-
26
- - name: Check FASTLED_PFX_B64 size
27
- run: |
28
- echo "FASTLED_PFX_B64 size: $(echo ${{ secrets.FASTLED_PFX_B64 }} | wc -c)"
@@ -1,31 +0,0 @@
1
- from tempfile import TemporaryDirectory
2
-
3
-
4
- def test_examples(
5
- examples: list[str] | None = None, host: str | None = None
6
- ) -> dict[str, Exception]:
7
- """Test the examples in the given directory."""
8
- from fastled import Api
9
-
10
- out: dict[str, Exception] = {}
11
- examples = Api.get_examples() if examples is None else examples
12
- with TemporaryDirectory() as tmpdir:
13
- for example in examples:
14
- print(f"Initializing example: {example}")
15
- sketch_dir = Api.project_init(example, outputdir=tmpdir, host=host)
16
- print(f"Project initialized at: {sketch_dir}")
17
- print(f"Compiling example: {example}")
18
- result = Api.web_compile(sketch_dir, host=host)
19
- if not result.success:
20
- out[example] = Exception(result.stdout)
21
- return out
22
-
23
-
24
- def unit_test() -> None:
25
- out = test_examples()
26
- if out:
27
- raise RuntimeError(f"Failed tests: {out}")
28
-
29
-
30
- if __name__ == "__main__":
31
- unit_test()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes