fastled 1.1.31__py2.py3-none-any.whl → 1.1.33__py2.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
@@ -1,3 +1,3 @@
1
1
  """FastLED Wasm Compiler package."""
2
2
 
3
- __version__ = "1.1.31"
3
+ __version__ = "1.1.33"
fastled/compile_server.py CHANGED
@@ -110,13 +110,13 @@ class CompileServer:
110
110
  print("Docker could not be started. Exiting.")
111
111
  raise RuntimeError("Docker could not be started. Exiting.")
112
112
  now = datetime.now(timezone.utc)
113
- now_str = now.strftime("%Y-%m-%d %H %Z")
113
+ now_str = now.strftime("%Y-%m-%d")
114
114
 
115
115
  upgrade = False
116
116
  if self.auto_updates is None:
117
117
  prev_date_str = DISK_CACHE.get("last-update")
118
118
  if prev_date_str != now_str:
119
- print("One hour has passed, checking docker for updates")
119
+ print("One day has passed, checking docker for updates")
120
120
  upgrade = True
121
121
  else:
122
122
  upgrade = self.auto_updates
fastled/open_browser.py CHANGED
@@ -13,11 +13,12 @@ def _open_browser_python(fastled_js: Path, port: int) -> Server:
13
13
  """Start livereload server in the fastled_js directory using API"""
14
14
  print(f"\nStarting livereload server in {fastled_js} on port {port}")
15
15
 
16
- server = Server()
17
- server.watch(str(fastled_js / "index.html"), delay=0.1)
18
- server.setHeader("Cache-Control", "no-cache")
19
- server.serve(root=str(fastled_js), port=port, open_url_delay=0.5)
20
- return server
16
+ # server = Server()
17
+ # server.watch(str(fastled_js / "index.html"), delay=0.1)
18
+ # server.setHeader("Cache-Control", "no-cache")
19
+ # server.serve(root=str(fastled_js), port=port, open_url_delay=0.5)
20
+ # return server
21
+ os.system(f"cd {fastled_js} && live-server")
21
22
 
22
23
 
23
24
  def _find_open_port(start_port: int) -> int:
fastled/parse_args.py CHANGED
@@ -106,6 +106,9 @@ def parse_args() -> argparse.Namespace:
106
106
 
107
107
  if args.init:
108
108
  args.directory = project_init()
109
+ print("\nInitialized FastLED project in", args.directory)
110
+ print(f"Use 'fastled {args.directory}' to compile the project.")
111
+ sys.exit(0)
109
112
 
110
113
  if not args.update:
111
114
  if args.no_auto_updates:
fastled/project_init.py CHANGED
@@ -5,28 +5,59 @@ import httpx
5
5
 
6
6
  from fastled.env import DEFAULT_URL
7
7
 
8
- ENDPOINT = f"{DEFAULT_URL}/project/init"
8
+ ENDPOINT_PROJECT_INIT = f"{DEFAULT_URL}/project/init"
9
+ ENDPOINT_INFO = f"{DEFAULT_URL}/info"
10
+ DEFAULT_EXAMPLE = "wasm"
9
11
 
10
12
 
11
- def project_init() -> Path:
13
+ def get_examples() -> list[str]:
14
+ response = httpx.get(ENDPOINT_INFO, timeout=4)
15
+ response.raise_for_status()
16
+ return response.json()["examples"]
17
+
18
+
19
+ def _prompt_for_example() -> str:
20
+ examples = get_examples()
21
+ while True:
22
+ print("Available examples:")
23
+ for i, example in enumerate(examples):
24
+ print(f" [{i+1}]: {example}")
25
+ answer = input("Enter the example number or name: ").strip()
26
+ if answer.isdigit():
27
+ example_num = int(answer) - 1
28
+ if example_num < 0 or example_num >= len(examples):
29
+ print("Invalid example number")
30
+ continue
31
+ return examples[example_num]
32
+ elif answer in examples:
33
+ return answer
34
+
35
+
36
+ def project_init(example: str | None = None, outputdir: Path | None = None) -> Path:
12
37
  """
13
38
  Initialize a new FastLED project.
14
39
  """
15
- response = httpx.get(ENDPOINT, timeout=20)
40
+
41
+ outputdir = outputdir or Path("fastled")
42
+ if example is None:
43
+ try:
44
+ example = _prompt_for_example()
45
+ except httpx.HTTPStatusError:
46
+ print(
47
+ f"Failed to fetch examples, using default example '{DEFAULT_EXAMPLE}'"
48
+ )
49
+ example = DEFAULT_EXAMPLE
50
+ assert example is not None
51
+ response = httpx.get(f"{ENDPOINT_PROJECT_INIT}/{example}", timeout=20)
16
52
  response.raise_for_status()
17
53
  content = response.content
18
- output = Path("fastled.zip")
19
- output.write_bytes(content)
20
- # unzip the content
21
- outdir = Path("fastled")
22
- if outdir.exists():
23
- print("Project already initialized.")
24
- return Path("fastled").iterdir().__next__()
25
- with zipfile.ZipFile(output, "r") as zip_ref:
26
- zip_ref.extractall(outdir)
27
- print(f"Project initialized successfully at {outdir}")
28
- output.unlink()
29
- return Path("fastled").iterdir().__next__()
54
+ tmpzip = outputdir / "fastled.zip"
55
+ outputdir.mkdir(exist_ok=True)
56
+ tmpzip.write_bytes(content)
57
+ with zipfile.ZipFile(tmpzip, "r") as zip_ref:
58
+ zip_ref.extractall(outputdir)
59
+ tmpzip.unlink()
60
+ return outputdir.iterdir().__next__()
30
61
 
31
62
 
32
63
  def unit_test() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.31
3
+ Version: 1.1.33
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -163,6 +163,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
163
163
 
164
164
  # Revisions
165
165
 
166
+ * 1.1.33 - Auto updating frequency has been reduced from one hour to one day. To update immediatly use `--update`.
167
+ * 1.1.32 - `--init` now asks for which example you want, then tells you where the example was downloaded to. No longer auto-compiles.
166
168
  * 1.1.31 - `--local` is auto-enabled if docker is installed, use `--web` to force web compiler. Updating is much more pretty.
167
169
  * 1.1.30 - Added `--init` to initialize a demo project.
168
170
  * 1.1.29 - Remove annoying dbg messages i left in.
@@ -1,17 +1,17 @@
1
- fastled/__init__.py,sha256=6jxxjP0Xri7C6EmI1qL3wfS_HKvFbZP2OMpSiZipIo8,61
1
+ fastled/__init__.py,sha256=eyxOXMKMOdKViwusOHSDh5Ctoda8SykpKQgKlPdIIeg,61
2
2
  fastled/app.py,sha256=Zw1RS72yyIZSDt1_08MDSzfY4YwLWzarwXM4nvy8GE4,1787
3
3
  fastled/build_mode.py,sha256=joMwsV4K1y_LijT4gEAcjx69RZBoe_KmFmHZdPYbL_4,631
4
4
  fastled/cli.py,sha256=CNR_pQR0sNVPNuv8e_nmm-0PI8sU-eUBUgnWgWkzW9c,237
5
5
  fastled/client_server.py,sha256=IK_u71XbmOAKBX1ovHATsCmfUON8VVJJu-XtObTuYJI,11448
6
- fastled/compile_server.py,sha256=Adb2lvJ_p6Ui7UMxijRtYJhbO4YPTERKVQeuoQgibSE,6724
6
+ fastled/compile_server.py,sha256=QnvlomTbFG2OmFj4ChuOXa0yBhhOvR8Bp1iIFsD3hbU,6717
7
7
  fastled/docker_manager.py,sha256=WVWg8ABWjdrX1P4vRRbW2z6yMOhhrHVtQ9H_cBBBAlI,23275
8
8
  fastled/env.py,sha256=8wctQwl5qE4CI8NBugHtgMmUfEfHZ869JX5lGdSOJxc,304
9
9
  fastled/filewatcher.py,sha256=5dVmjEG23kMeJa29tRVm5XKSr9sTD4ME2boo-CFDuUM,6910
10
10
  fastled/keyboard.py,sha256=Zz_ggxOUTX2XQEy6K6kAoorVlUev4wEk9Awpvv9aStA,3241
11
- fastled/open_browser.py,sha256=-2_vyf6dbi2xGex-CMZHVVcXvwXGJkLOwFcjHGxknUQ,1769
12
- fastled/parse_args.py,sha256=2O6lB6Nf0ZfNv10AHFK3fkN35DCrpX4dBByZa0u6XR4,5537
11
+ fastled/open_browser.py,sha256=ERDHvsJKl7yKHX7UJKm35eCeQ1fRXseWdZavV962O0A,1829
12
+ fastled/parse_args.py,sha256=PoFA9BVXexPf6g4tVIDigzCCOTHqV9aSbs71WqDhJZI,5696
13
13
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
14
- fastled/project_init.py,sha256=9GmyaRsXa1fNuzqpv0lcpkSFTOFszpEZ3jr788zZNp0,870
14
+ fastled/project_init.py,sha256=ndQICZ9rBtfEPOnucZ3cgRE67PUKc66CJYO4Tkwmt_M,1932
15
15
  fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffER2NfM,1314
16
16
  fastled/sketch.py,sha256=5nRjg281lMH8Bo9wKjbcpTQCfEP574ZCG-lukvFmyQ8,2656
17
17
  fastled/spinner.py,sha256=ZGFXona3SJxmuHIzMGa6tqB0IVDSRr8W_dju09Z1Hwg,901
@@ -20,9 +20,9 @@ fastled/types.py,sha256=dDIsGHJkHNJ7B61wNp6X0JSLs_nrHiq7RlNqNWbwFec,194
20
20
  fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
21
21
  fastled/web_compile.py,sha256=KuvKGdX6SSUUqC7YgX4T9SMSP5wdcPUhpg9-K9zPoTI,10378
22
22
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
23
- fastled-1.1.31.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
24
- fastled-1.1.31.dist-info/METADATA,sha256=Q4cS70DetU08f-0-GUc6CxTrCI3R9FJArBszGUA7r_I,14666
25
- fastled-1.1.31.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
26
- fastled-1.1.31.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
27
- fastled-1.1.31.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
28
- fastled-1.1.31.dist-info/RECORD,,
23
+ fastled-1.1.33.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
24
+ fastled-1.1.33.dist-info/METADATA,sha256=7B_rRK0Kg8FdvPPnjn0nE26RyvH3DJDlsDI0lguSvOc,14921
25
+ fastled-1.1.33.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
26
+ fastled-1.1.33.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
27
+ fastled-1.1.33.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
28
+ fastled-1.1.33.dist-info/RECORD,,