fastled 1.1.88__py3-none-any.whl → 1.2.0__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 CHANGED
@@ -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.0"
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(
@@ -110,6 +113,13 @@ class Api:
110
113
 
111
114
 
112
115
  class Test:
116
+
117
+ @staticmethod
118
+ def can_run_local_docker_tests() -> bool:
119
+ from fastled.test.can_run_local_docker_tests import can_run_local_docker_tests
120
+
121
+ return can_run_local_docker_tests()
122
+
113
123
  @staticmethod
114
124
  def test_examples(
115
125
  examples: list[str] | None = None, host: str | CompileServer | None = None
fastled/app.py CHANGED
@@ -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,
fastled/project_init.py CHANGED
@@ -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
 
@@ -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"
fastled/test/examples.py CHANGED
@@ -1,4 +1,8 @@
1
1
  from tempfile import TemporaryDirectory
2
+ from time import time
3
+ from warnings import warn
4
+
5
+ _FILTER = True
2
6
 
3
7
 
4
8
  def test_examples(
@@ -8,13 +12,24 @@ def test_examples(
8
12
  from fastled import Api
9
13
 
10
14
  out: dict[str, Exception] = {}
11
- examples = Api.get_examples() if examples is None else examples
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")
12
19
  with TemporaryDirectory() as tmpdir:
13
20
  for example in examples:
14
21
  print(f"Initializing example: {example}")
15
- sketch_dir = Api.project_init(example, outputdir=tmpdir, host=host)
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
16
28
  print(f"Project initialized at: {sketch_dir}")
29
+ start = time()
17
30
  print(f"Compiling example: {example}")
31
+ diff = time() - start
32
+ print(f"Compilation took: {diff:.2f} seconds")
18
33
  result = Api.web_compile(sketch_dir, host=host)
19
34
  if not result.success:
20
35
  out[example] = Exception(result.stdout)
@@ -22,9 +37,12 @@ def test_examples(
22
37
 
23
38
 
24
39
  def unit_test() -> None:
25
- out = test_examples()
26
- if out:
27
- raise RuntimeError(f"Failed tests: {out}")
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}")
28
46
 
29
47
 
30
48
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.88
3
+ Version: 1.2.0
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.
50
49
 
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.
50
+ In every conceivable way, the local compiler will be much faster than the web version.
53
51
 
52
+ # Demo
53
+
54
+ https://zackees.github.io/fastled-wasm/
55
+
56
+ # Tutorial video
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
 
@@ -257,9 +262,9 @@ A: `delay()` will block `loop()` which blocks the main thread of the browser. Th
257
262
  Q: How can I get the compiled size of my FastLED sketch smaller?
258
263
  A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
259
264
 
260
-
261
265
  # Revisions
262
266
 
267
+ * 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
268
  * 1.1.69 - Changed the binary name to `fastled.exe` instead of something like `fastled-windows-x64.exe`
264
269
  * 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
270
  * 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,5 +1,5 @@
1
- fastled/__init__.py,sha256=D282INW9LxPw4mZCC17pye4xt-z0O6fJZip52U-jJxk,3925
2
- fastled/app.py,sha256=AHLQczFKLV1ZyGCh45wTvJqQpQyJ_Ukh3MmG3Om4NHQ,1844
1
+ fastled/__init__.py,sha256=eRL6Kzu-3m84oZ9e_5JczvV90MKmxJGvQQQRvIY19EI,4258
2
+ fastled/app.py,sha256=Y1Q5mx4zdQbZ2AaB43ZqJo-w_8ehAaWVNtvTyeCRSaE,1970
3
3
  fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
4
4
  fastled/client_server.py,sha256=8L62zNtkGtErDtWrr4XVNsv7ji2zoS5rlqfCnwI3VKU,13177
5
5
  fastled/compile_server.py,sha256=Z7rHFs3M6QPbSCsbgHAQDk6GTVAJMMPCXtD4Y0mu8RM,2659
@@ -11,7 +11,7 @@ fastled/live_client.py,sha256=_KvqmyUyyGpoYET1Z9CdeUVoIbFjIUWwPcTp5XCQuxY,2075
11
11
  fastled/open_browser.py,sha256=vzMBcpDNY0f-Bx9KmEILKDANZ6gvsywCVwn1FRhPXh4,1770
12
12
  fastled/parse_args.py,sha256=qsikaRmRDPOosPF1AmfjaATSwH2xxJbKDKswOyVn2oM,6254
13
13
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
14
- fastled/project_init.py,sha256=2WBdCN01hBfoYJn-x3TD5KsJEo5BTrHzr2QyszGzZAU,2416
14
+ fastled/project_init.py,sha256=QEghpy5Vonc_fTF--3L5ySrQ1bDpdJpfnlEHHQLDKRk,2287
15
15
  fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffER2NfM,1314
16
16
  fastled/settings.py,sha256=3eMKv0tLXgIQ0CFDboIp_l5_71rzIIyWg353YjnYJnc,323
17
17
  fastled/sketch.py,sha256=483TrrIdZJfo1MIu5FkD-V5OGmOfHmsZ2f6VvNsJBJM,3299
@@ -22,10 +22,11 @@ fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
22
22
  fastled/web_compile.py,sha256=05PeLJ77QQC6PUKjDhsntBmyBola6QQIfF2k-zjYNE4,10261
23
23
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
24
24
  fastled/site/build.py,sha256=UDWaked5QFPibbKZSoDrQgiP1Laoh8f0Fbj8Qfey0I4,12503
25
- fastled/test/examples.py,sha256=EDXb6KastKOOWzew99zrpmcNcXTcAtYi8eud6F1pnWA,980
26
- fastled-1.1.88.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
27
- fastled-1.1.88.dist-info/METADATA,sha256=ElHNWdBrZiXj0gmUsNmRN7GMMZ8hECrTDnTXZB0q8r8,18951
28
- fastled-1.1.88.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
29
- fastled-1.1.88.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
30
- fastled-1.1.88.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
31
- fastled-1.1.88.dist-info/RECORD,,
25
+ fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
26
+ fastled/test/examples.py,sha256=6xPwx_k9_XwYTpI1nk4SrYbsJKHJACd30GzD1epGqhY,1597
27
+ fastled-1.2.0.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
28
+ fastled-1.2.0.dist-info/METADATA,sha256=POxzspBb64BD74PBEe0WAE5qw7cNsDhhLGbBAp-SkDQ,19277
29
+ fastled-1.2.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
30
+ fastled-1.2.0.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
31
+ fastled-1.2.0.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
32
+ fastled-1.2.0.dist-info/RECORD,,