fastled 1.1.45__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.
@@ -0,0 +1,323 @@
1
+ Metadata-Version: 2.1
2
+ Name: fastled
3
+ Version: 1.1.45
4
+ Summary: FastLED Wasm Compiler
5
+ Home-page: https://github.com/zackees/fastled-wasm
6
+ Maintainer: Zachary Vorhies
7
+ License: BSD 3-Clause License
8
+ Keywords: template-python-cmd
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: docker
14
+ Requires-Dist: httpx
15
+ Requires-Dist: watchdog
16
+ Requires-Dist: livereload
17
+ Requires-Dist: download
18
+ Requires-Dist: filelock
19
+ Requires-Dist: disklru>=2.0.1
20
+ Requires-Dist: appdirs
21
+ Requires-Dist: rapidfuzz
22
+ Requires-Dist: progress
23
+
24
+ # FastLED Wasm compiler
25
+
26
+ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directly in the web browser.
27
+
28
+
29
+ [![Linting](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/lint.yml)
30
+ [![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
+ [![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)
32
+ [![Win_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml)
33
+
34
+ [![Build and Push Multi Docker Image](https://github.com/zackees/fastled-wasm/actions/workflows/build_multi_docker_image.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/build_multi_docker_image.yml)
35
+ [![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
+ [![Create Version Tag](https://github.com/zackees/fastled-wasm/actions/workflows/create_version_tag.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/create_version_tag.yml)
37
+ [![Build and Publish Release](https://github.com/zackees/fastled-wasm/actions/workflows/build_release.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/build_release.yml)
38
+
39
+
40
+ # About
41
+
42
+ This python app will compile your FastLED style sketches into html/js/wasm output that runs directly in the browser.
43
+
44
+ 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.
45
+
46
+ 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.
47
+
48
+ The local compiler will be much faster than the web version in most circumstances after the first compile. The web compiler
49
+ has the advantage that as a persistant service the compile cache will remain much more up to date.
50
+
51
+
52
+ https://github.com/user-attachments/assets/64ae0e6c-5f8b-4830-ab87-dcc25bc61218
53
+
54
+ # Demo
55
+
56
+ https://zackees.github.io/fastled-wasm/
57
+
58
+
59
+ # Install
60
+
61
+ ```bash
62
+ pip install fastled
63
+ ```
64
+
65
+ **Note that you may need to install x86 docker emulation on Mac-m1 and later, as this is an x86 only image at the prsent.**
66
+
67
+ # Command Line Use
68
+
69
+ Change to the directory where the sketch lives and run, will run the compilation
70
+ on the web compiler.
71
+
72
+ ```bash
73
+ # This will use the web-compiler, unless you have docker installed in which case a local
74
+ # server will be instantiated automatically.
75
+ cd <SKETCH-DIRECTORY>
76
+ fastled
77
+ ```
78
+
79
+ Forces the local server to to spawn in order to run to do the compile.
80
+
81
+ ```bash
82
+ cd <SKETCH-DIRECTORY>
83
+ fastled --local # if server doesn't already exist, one is created.
84
+ ```
85
+
86
+ You can also spawn a server in one process and then access it in another, like this:
87
+
88
+ ```bash
89
+ fastled --server # server will now run in the background.
90
+ # now launch the client
91
+ fastled examples/wasm --local # local will find the local server use it do the compile.
92
+ ```
93
+
94
+ After compilation a web browser windows will pop up. Changes to the sketch will automatically trigger a recompilation.
95
+
96
+ # Python Api
97
+
98
+ **Compiling through the api**
99
+ ```python
100
+
101
+ from fastapi import Api, CompileResult
102
+
103
+ out: CompileResult = Api.web_compile("path/to/sketch")
104
+ print(out.success)
105
+ print(out.stdout)
106
+
107
+ ```
108
+
109
+ **Launching a compile server**
110
+ ```python
111
+
112
+ from fastapi import Api, CompileServer
113
+
114
+ server: CompileServer = Api.spawn_server()
115
+ print(f"Local server running at {server.url()}")
116
+ server.web_compile("path/to/sketch") # output will be "path/to/sketch/fastled_js"
117
+ server.stop()
118
+ ```
119
+
120
+ **Launching a server in a scope**
121
+ ```python
122
+
123
+ from fastapi import Api
124
+
125
+ # Launching a server in a scope
126
+ with Api.server() as server:
127
+ server.web_compile("path/to/sketch")
128
+
129
+ ```
130
+
131
+ **Initializing a project example from the web compiler**
132
+ ```python
133
+
134
+ from fastapi import Api
135
+
136
+ examples = Api.get_examples()
137
+ print(f"Print available examples: {examples}")
138
+ Api.project_init(examples[0])
139
+
140
+
141
+ ```
142
+
143
+ **Initializing a project example from the CompileServer**
144
+ ```python
145
+
146
+ from fastapi import Api
147
+
148
+ with Api.server() as server:
149
+ examples = server.get_examples()
150
+ server.project_init(examples[0])
151
+
152
+ ```
153
+
154
+ **LiveClient will auto-trigger a build on code changes, just like the cli does**
155
+ ```python
156
+
157
+ # Live Client will compile against the web-compiler
158
+ from fastapi import Api, LiveClient
159
+ client: LiveClient = Api.live_client(
160
+ "path/to/sketch_directory",
161
+ )
162
+ # Now user can start editing their sketch and it will auto-compile
163
+ # ... after a while stop it like this.
164
+ client.stop()
165
+ ```
166
+
167
+ **LiveClient with local CompileServer**
168
+ ```python
169
+
170
+ # Live Client will compile against a local server.
171
+ from fastapi import Api, LiveClient
172
+
173
+ with Api.server() as server:
174
+ client: LiveClient = Api.live_client(
175
+ "path/to/sketch_directory",
176
+ host=server
177
+ )
178
+ # Now user can start editing their sketch and it will auto-compile
179
+ # ... after a while stop it like this.
180
+ client.stop()
181
+ ```
182
+
183
+ # Features
184
+
185
+ ## Hot reload by default
186
+
187
+ Once launched, the compiler will remain open, listening to changes and recompiling as necessary and hot-reloading the sketch into the current browser.
188
+
189
+ This style of development should be familiar to those doing web development.
190
+
191
+ ## Hot Reload fastled/src when working in the FastLED repo
192
+
193
+ If you launch `fastled` in the FastLED repo then this tool will automatically detect this and map the src directory into the
194
+ host container. Whenever there are changes in the source code from the mapped directory, then these will be re-compiled
195
+ on the next change or if you hit the space bar when prompted. Unlike a sketch folder, a re-compile on the FastLED src
196
+ can be much longer, for example if you modify a header file.
197
+
198
+ ## Big Data in `/data` directory won't be round-tripped
199
+
200
+ Huge blobs of data like video will absolutely kill the compile performance as these blobs would normally have to be shuffled
201
+ back and forth. Therefore a special directory `data/` is implicitly used to hold this blob data. Any data in this directory
202
+ will be replaced with a stub containing the size and hash of the file during upload. On download these stubs are swapped back
203
+ with their originals during decompression.
204
+
205
+ The wasm compiler will recognize all files in the `data/` directory and generate a `files.json` manifest and can be used
206
+ in your wasm sketch using an emulated SD card system mounted at `/data/` on the SD Card. In order to increase load speed, these
207
+ files will be asynchroniously streamed into the running sketch instance during runtime. Files named with *.json, *.csv, *.txt will be
208
+ immediately injected in the app before setup() is called and can be used immediatly in setup() in their entirety.
209
+
210
+ All other files will be streamed in. The `Video` element in FastLED is designed to gracefully handle missing data streamed in through
211
+ the file system.
212
+
213
+ For an example of how to use this see `examples/SdCard` which is fully wasm compatible.
214
+
215
+ ## Compile Speed
216
+
217
+ The compile speeds for this compiler have been optimized pretty much to the max. There are three compile settings available to the user. The default is `--quick`. Aggressive optimizations are done with `--release` which will aggressively optimize for size. The speed difference between `--release` and `--quick` seems negligable. But `--release` will produce a ~1/3 smaller binary. There is also `--debug`, which will include symbols necessary for debugging and getting the C++ function symbols working correctly in the browser during step through debugging. It works better than expected, but don't expect to have gdb or msvc debugger level of debugging experience.
218
+
219
+ We use `ccache` to cache object files. This seems actually help a lot and is better than platformio's method of tracking what needs to be rebuilt. This works as a two tier cache system. What Platformio misses will be covered by ccache's more advanced file changing system.
220
+
221
+ The compilation to wasm will happen under a lock. Removing this lock requires removing the platformio toolchain as the compiler backend which enforces it's own internal lock preventing parallel use.
222
+
223
+ ## Sketch Cache
224
+
225
+ Sketchs are aggressively finger-printed and stored in a cache. White space, comments, and other superficial data will be stripped out during pre-processing and minimization for fingerprinting. This source file decimation is only used for finger
226
+ printing while the actual source files are sent to compiler to preserve line numbers and file names.
227
+
228
+ This pre-processing done is done via gcc and special regex's and will happen without a lock. This will allow you to have extremely quick recompiles for whitespace and changes in comments even if the compiler is executing under it's lock.
229
+
230
+ ## Local compiles
231
+
232
+ If the web-compiler get's congested then it's recommend that you run the compiler locally. This requires docker and will be invoked whenever you pass in `--local`. This will first pull the most recent Docker image of the Fastled compiler, launching a webserver and then connecting to it with the client once it's been up.
233
+
234
+ ## Auto updates
235
+
236
+ In server mode the git repository will be cloned as a side repo and then periodically updated and rsync'd to the src directory. This allows a long running instance to stay updated.
237
+
238
+ ## Compatibility with Arduino sketchs
239
+
240
+ The compatibility is actually pretty good. Most simple sketchs should compile out of the box. Even some of the avr platform includes are stubbed out to make it work. The familiar `digitalWrite()`, `Serial.println()` and other common functions work. Although `digitalRead()` will always return 0 and `analogRead()` will return random numbers.
241
+
242
+ ### Faqs
243
+
244
+ Q: How often is the docker image updated?
245
+ A: It's scheduled for rebuild once a day at 3am Pacific time, and also on every change to this repo.
246
+
247
+ Q: How can I run my own cloud instance of the FastLED wasm compiler?
248
+ A: Render.com (which fastled is hosted on) or DigialOcean can accept a github repo and auto-build the docker image.
249
+
250
+ Q: Why does FastLED tend to become choppy when the browser is in the background?
251
+ A: FastLED Wasm currently runs on the main thread and therefor Chrome will begin throttling the event loop when the browser is not in the foreground. The solution to this is to move FastLED to a web worker where it will get a background thread that Chrome / Firefox won't throttle.
252
+
253
+ Q: Why does a long `delay()` cause the browser to freeze and become sluggish?
254
+ A: `delay()` will block `loop()` which blocks the main thread of the browser. The solution is a webworker which will not affect main thread performance of the browser.
255
+
256
+
257
+ Q: How can I get the compiled size of my FastLED sketch smaller?
258
+ A: A big chunk of space is being used by unnecessary javascript `emscripten` is bundling. This can be tweeked by the wasm_compiler_settings.py file in the FastLED repo.
259
+
260
+
261
+ # Revisions
262
+
263
+ * 1.1.45 - Aniother try for web publishing from github.
264
+ * 1.1.42 - Second test for web publishing from github.
265
+ * 1.1.41 - Platform executable (through pyinstaller) now enabled.
266
+ * 1.1.40 - Remove `sketch_directory` from Api object. This was only needed before we had a client/server architecture.
267
+ * 1.1.39 - Added `LiveClient`, `fastled.Api.live_server()` will spawn it. Allows user to have a live compiling client that re-triggers a compile on file changes.
268
+ * 1.1.38 - Cleanup the `fastled.Api` object and streamline for general use.
269
+ * 1.1.37 - `Test.test_examples()` is now unit tested to work correctly.
270
+ * 1.1.36 - We now have an api. `from fastled import Api` and `from fastled import Test` for testing.
271
+ * 1.1.35 - When searching for files cap the limit at a high amount to prevent hang.
272
+ * 1.1.34 - On windows check to make sure we are in linux container mode, if not try to switch and if that fails then use `--web` compiler.
273
+ * 1.1.33 - Auto updating frequency has been reduced from one hour to one day. To update immediatly use `--update`.
274
+ * 1.1.32 - `--init` now asks for which example you want, then tells you where the example was downloaded to. No longer auto-compiles.
275
+ * 1.1.31 - `--local` is auto-enabled if docker is installed, use `--web` to force web compiler. Updating is much more pretty.
276
+ * 1.1.30 - Added `--init` to initialize a demo project.
277
+ * 1.1.29 - Remove annoying dbg messages i left in.
278
+ * 1.1.28 - Adds cache control headers to the live server to disable all caching in the live browser.
279
+ * 1.1.27 - Fixed `--interactive` so that it now works correctly.
280
+ * 1.1.25 - Improved detecting which sketch directory the user means by fuzzy matching.
281
+ * 1.1.24 - Adds progress spinning bar for pulling images, which take a long time.
282
+ * 1.1.23 - Various fixes for MacOS
283
+ * 1.1.22 - Selecting sketch now allows strings and narrowing down paths if ambiguity
284
+ * 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
285
+ * 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
286
+ * 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
287
+ * 1.1.18 - Fixes for when the image has never been downloaded.
288
+ * 1.1.17 - Added `--update` and `--no-auto-update` to control whether the compiler in docker mode will try to update.
289
+ * 1.1.16 - Rewrote docker logic to use container suspension and resumption. Much much faster.
290
+ * 1.1.15 - Fixed logic for considering ipv6 addresses. Auto selection of ipv6 is now restored.
291
+ * 1.1.14 - Fixes for regression in using --server and --localhost as two instances, this is now under test.
292
+ * 1.1.13 - Disable the use of ipv6. It produces random timeouts on the onrender server we are using for the web compiler.
293
+ * 1.1.12 - By default, fastled will default to the web compiler. `--localhost` to either attach to an existing server launched with `--server` or else one will be created automatically and launched.
294
+ * 1.1.11 - Dev improvement: FastLED src code volume mapped into docker will just in time update without having to manually trigger it.
295
+ * 1.1.10 - Swap large assets with embedded placeholders. This helps video sketches upload and compile instantly. Assets are re-added on after compile artifacts are returned.
296
+ * 1.1.9 - Remove auto server and instead tell the user corrective action to take.
297
+ * 1.1.8 - Program now knows it's own version which will be displayed with help file. Use `--version` to get it directly.
298
+ * 1.1.7 - Sketch cache re-enabled, but selectively invalidated on cpp/h updates. Cleaned up deprecated args. Fixed double thread running for containers that was causing slowdown.
299
+ * 1.1.6 - Use the fast src volume map allow quick updates to fastled when developing on the source code.
300
+ * 1.1.5 - Filter out hidden files and directories from being included in the sketch archive sent to the compiler.
301
+ * 1.1.4 - Fix regression introduced by testing out ipv4/ipv6 connections from a thread pool.
302
+ * 1.1.3 - Live editing of *.h and *.cpp files is now possible. Sketch cache will be disabled in this mode.
303
+ * 1.1.2 - `--server` will now volume map fastled src directory if it detects this. This was also implemented on the docker side.
304
+ * 1.1.1 - `--interactive` is now supported to debug the container. Volume maps and better compatibilty with ipv4/v6 by concurrent connection finding.
305
+ * 1.1.0 - Use `fastled` as the command for the wasm compiler.
306
+ * 1.0.17 - Pulls updates when necessary. Removed dependency on keyring.
307
+ * 1.0.16 - `fastled-wasm` package name has been changed to `fled`
308
+ * 1.0.15 - `fled` is an alias of `fastled-wasm` and will eventually replace it. `--web-host` was folded into `--web`, which if unspecified will attempt to run a local docker server and fallback to the cloud server if that fails. Specifying `--web` with no arguments will default to the cloud server while an argument (like `localhost`) will cause it to bind to that already running server for compilation.
309
+ * 1.0.14 - For non significant changes (comments, whitespace) in C++/ino/*.h files, compilation is skipped. This significantly reduces load on the server and prevents unnecessary local client browser refreshes.
310
+ * 1.0.13 - Increase speed of local compiles by running the server version of the compiler so it can keep it's cache and not have to pay docker startup costs because now it's a persistant server until exit.
311
+ * 1.0.12 - Added suppport for compile modes. Pass in `--release`, `--quick`, `--debug` for different compile options. We also support `--profile` to profile the build process.
312
+ * 1.0.11 - `--web` compile will automatically be enabled if the local build using docker fails.
313
+ * 1.0.10 - Watching files is now available for `--web`
314
+ * 1.0.9 - Enabled web compile. Access it with `--web` or `--web-host`
315
+ * 1.0.8 - Allow more than one fastled-wasm browser instances to co-exist by searching for unused ports after 8081.
316
+ * 1.0.7 - Docker multi image build implemented, tool now points to new docker image compile.
317
+ * 1.0.6 - Removed `--no-open` and `--watch`, `--watch` is now assumed unless `--just-compile` is used.
318
+ * 1.0.5 - Implemented `--update` to update the compiler image from the docker registry.
319
+ * 1.0.4 - Implemented `--watch` which will watch for changes and then re-launch the compilation step.
320
+ * 1.0.3 - Integrated `live-server` to launch when available.
321
+ * 1.0.2 - Small bug with new installs.
322
+ * 1.0.1 - Re-use is no longer the default, due to problems.
323
+ * 1.0.0 - Initial release.
@@ -0,0 +1,30 @@
1
+ fastled/__init__.py,sha256=fXkCeFWmPemmBwo5jnTUMcxhRR1oEKEQayV8ZGG_lbY,3462
2
+ fastled/app.py,sha256=3xg7oVD-UYnKPU8SAY-Cs5UnAYdwpdpuEFRR2N8P1Tg,1787
3
+ fastled/cli.py,sha256=CNR_pQR0sNVPNuv8e_nmm-0PI8sU-eUBUgnWgWkzW9c,237
4
+ fastled/client_server.py,sha256=MGE4rg40EA2ty6nKExVxkjUbPbif1Bbx0vDjwNcDOD8,12563
5
+ fastled/compile_server.py,sha256=Z7rHFs3M6QPbSCsbgHAQDk6GTVAJMMPCXtD4Y0mu8RM,2659
6
+ fastled/compile_server_impl.py,sha256=ClBLtFHB0ucaT8tAJfI6o3bJ-LRnXc4Pxy7bVKnFiww,8803
7
+ fastled/docker_manager.py,sha256=zBCFGk2P3_bS7_SUQ5j2lpsOS3RvIzXYkrJXC6xP69k,25383
8
+ fastled/filewatcher.py,sha256=LwEQJkqADsArZyY499RLAer6JjJyDwaQBcAvT7xmp3c,6708
9
+ fastled/keyboard.py,sha256=Zz_ggxOUTX2XQEy6K6kAoorVlUev4wEk9Awpvv9aStA,3241
10
+ fastled/live_client.py,sha256=_KvqmyUyyGpoYET1Z9CdeUVoIbFjIUWwPcTp5XCQuxY,2075
11
+ fastled/open_browser.py,sha256=vzMBcpDNY0f-Bx9KmEILKDANZ6gvsywCVwn1FRhPXh4,1770
12
+ fastled/parse_args.py,sha256=FKLucZPQoprln1U_L9ZhigLmoUwyGjN5U53LtIJ-rxQ,6141
13
+ fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
14
+ fastled/project_init.py,sha256=We-fVf4FqFcXhKUqjWnhV1HXmfXbo-1nCBMJ_TCip2U,2177
15
+ fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffER2NfM,1314
16
+ fastled/settings.py,sha256=3eMKv0tLXgIQ0CFDboIp_l5_71rzIIyWg353YjnYJnc,323
17
+ fastled/sketch.py,sha256=483TrrIdZJfo1MIu5FkD-V5OGmOfHmsZ2f6VvNsJBJM,3299
18
+ fastled/spinner.py,sha256=VHxmvB92P0Z_zYxRajb5HiNmkHHvZ5dG7hKtZltzpcs,867
19
+ fastled/string_diff.py,sha256=UR1oRhg9lsPzAG4bn_MwJMCn0evP5AigkBiwLiI9fgA,1354
20
+ fastled/types.py,sha256=PpSEtzFCkWtSIEMC0QXGl966R97vLoryVl3yFW0YhTs,1475
21
+ fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
22
+ fastled/web_compile.py,sha256=05PeLJ77QQC6PUKjDhsntBmyBola6QQIfF2k-zjYNE4,10261
23
+ fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
24
+ fastled/test/examples.py,sha256=EDXb6KastKOOWzew99zrpmcNcXTcAtYi8eud6F1pnWA,980
25
+ fastled-1.1.45.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
26
+ fastled-1.1.45.dist-info/METADATA,sha256=c0Dimqkl2MnOUXzuxgcdRyHglYZYNLiA6qBpZeB04OY,18461
27
+ fastled-1.1.45.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
28
+ fastled-1.1.45.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
29
+ fastled-1.1.45.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
30
+ fastled-1.1.45.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.6.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ fastled = fastled.cli:main
3
+ fastled-wasm = fastled.cli:main
4
+ fled = fastled.cli:main
@@ -0,0 +1 @@
1
+ fastled