fastled 1.2.19__tar.gz → 1.2.21__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 (83) hide show
  1. {fastled-1.2.19 → fastled-1.2.21}/PKG-INFO +3 -1
  2. {fastled-1.2.19 → fastled-1.2.21}/README.md +1 -0
  3. {fastled-1.2.19 → fastled-1.2.21}/pyproject.toml +1 -0
  4. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/__init__.py +5 -3
  5. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/compile_server.py +6 -1
  6. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/open_browser.py +42 -3
  7. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/open_browser2.py +17 -35
  8. {fastled-1.2.19 → fastled-1.2.21}/src/fastled.egg-info/PKG-INFO +3 -1
  9. {fastled-1.2.19 → fastled-1.2.21}/src/fastled.egg-info/requires.txt +1 -0
  10. {fastled-1.2.19 → fastled-1.2.21}/.aiderignore +0 -0
  11. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/build_multi_docker_image.yml +0 -0
  12. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/build_webpage.yml +0 -0
  13. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/lint.yml +0 -0
  14. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/publish_release.yml +0 -0
  15. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/test_build_exe.yml +0 -0
  16. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/test_macos.yml +0 -0
  17. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/test_ubuntu.yml +0 -0
  18. {fastled-1.2.19 → fastled-1.2.21}/.github/workflows/test_win.yml +0 -0
  19. {fastled-1.2.19 → fastled-1.2.21}/.gitignore +0 -0
  20. {fastled-1.2.19 → fastled-1.2.21}/.pylintrc +0 -0
  21. {fastled-1.2.19 → fastled-1.2.21}/.vscode/launch.json +0 -0
  22. {fastled-1.2.19 → fastled-1.2.21}/.vscode/settings.json +0 -0
  23. {fastled-1.2.19 → fastled-1.2.21}/.vscode/tasks.json +0 -0
  24. {fastled-1.2.19 → fastled-1.2.21}/LICENSE +0 -0
  25. {fastled-1.2.19 → fastled-1.2.21}/MANIFEST.in +0 -0
  26. {fastled-1.2.19 → fastled-1.2.21}/RELEASE.md +0 -0
  27. {fastled-1.2.19 → fastled-1.2.21}/TODO.md +0 -0
  28. {fastled-1.2.19 → fastled-1.2.21}/build_exe.py +0 -0
  29. {fastled-1.2.19 → fastled-1.2.21}/build_site.py +0 -0
  30. {fastled-1.2.19 → fastled-1.2.21}/clean +0 -0
  31. {fastled-1.2.19 → fastled-1.2.21}/install +0 -0
  32. {fastled-1.2.19 → fastled-1.2.21}/lint +0 -0
  33. {fastled-1.2.19 → fastled-1.2.21}/requirements.testing.txt +0 -0
  34. {fastled-1.2.19 → fastled-1.2.21}/setup.cfg +0 -0
  35. {fastled-1.2.19 → fastled-1.2.21}/setup.py +0 -0
  36. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/app.py +0 -0
  37. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/assets/example.txt +0 -0
  38. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/cli.py +0 -0
  39. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/client_server.py +0 -0
  40. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/compile_server_impl.py +0 -0
  41. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/docker_manager.py +0 -0
  42. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/filewatcher.py +0 -0
  43. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/keyboard.py +0 -0
  44. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/live_client.py +0 -0
  45. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/parse_args.py +0 -0
  46. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/paths.py +0 -0
  47. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/project_init.py +0 -0
  48. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/select_sketch_directory.py +0 -0
  49. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/settings.py +0 -0
  50. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/site/build.py +0 -0
  51. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/sketch.py +0 -0
  52. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/spinner.py +0 -0
  53. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/string_diff.py +0 -0
  54. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/test/can_run_local_docker_tests.py +0 -0
  55. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/test/examples.py +0 -0
  56. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/types.py +0 -0
  57. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/util.py +0 -0
  58. {fastled-1.2.19 → fastled-1.2.21}/src/fastled/web_compile.py +0 -0
  59. {fastled-1.2.19 → fastled-1.2.21}/src/fastled.egg-info/SOURCES.txt +0 -0
  60. {fastled-1.2.19 → fastled-1.2.21}/src/fastled.egg-info/dependency_links.txt +0 -0
  61. {fastled-1.2.19 → fastled-1.2.21}/src/fastled.egg-info/entry_points.txt +0 -0
  62. {fastled-1.2.19 → fastled-1.2.21}/src/fastled.egg-info/top_level.txt +0 -0
  63. {fastled-1.2.19 → fastled-1.2.21}/test +0 -0
  64. {fastled-1.2.19 → fastled-1.2.21}/tests/html/index.html +0 -0
  65. {fastled-1.2.19 → fastled-1.2.21}/tests/test_api.py +0 -0
  66. {fastled-1.2.19 → fastled-1.2.21}/tests/test_bad_ino.py +0 -0
  67. {fastled-1.2.19 → fastled-1.2.21}/tests/test_build.py +0 -0
  68. {fastled-1.2.19 → fastled-1.2.21}/tests/test_build_examples.py +0 -0
  69. {fastled-1.2.19 → fastled-1.2.21}/tests/test_cli.py +0 -0
  70. {fastled-1.2.19 → fastled-1.2.21}/tests/test_compile_server.py +0 -0
  71. {fastled-1.2.19 → fastled-1.2.21}/tests/test_docker_linux_on_windows.py +0 -0
  72. {fastled-1.2.19 → fastled-1.2.21}/tests/test_embedded_data.py +0 -0
  73. {fastled-1.2.19 → fastled-1.2.21}/tests/test_examples.py +0 -0
  74. {fastled-1.2.19 → fastled-1.2.21}/tests/test_filechanger.py +0 -0
  75. {fastled-1.2.19 → fastled-1.2.21}/tests/test_http_server.py +0 -0
  76. {fastled-1.2.19 → fastled-1.2.21}/tests/test_ino/bad/bad.ino +0 -0
  77. {fastled-1.2.19 → fastled-1.2.21}/tests/test_ino/embedded/data/bigdata.dat +0 -0
  78. {fastled-1.2.19 → fastled-1.2.21}/tests/test_ino/embedded/wasm.ino +0 -0
  79. {fastled-1.2.19 → fastled-1.2.21}/tests/test_ino/wasm/wasm.ino +0 -0
  80. {fastled-1.2.19 → fastled-1.2.21}/tests/test_project_init.py +0 -0
  81. {fastled-1.2.19 → fastled-1.2.21}/tests/test_server_and_client_seperatly.py +0 -0
  82. {fastled-1.2.19 → fastled-1.2.21}/tests/test_webcompile.py +0 -0
  83. {fastled-1.2.19 → fastled-1.2.21}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.2.19
3
+ Version: 1.2.21
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -20,6 +20,7 @@ Requires-Dist: appdirs>=1.4.4
20
20
  Requires-Dist: rapidfuzz>=3.10.1
21
21
  Requires-Dist: progress>=1.6
22
22
  Requires-Dist: Flask>=3.0.0
23
+ Requires-Dist: livereload
23
24
 
24
25
  # FastLED Wasm compiler
25
26
 
@@ -285,6 +286,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
285
286
 
286
287
  # Revisions
287
288
 
289
+ * 1.2.20 - Fixed up path issue for web browser launch for hot reload.
288
290
  * 1.2.19 - Compilation failure now overwrites the index.html file with error message.
289
291
  * 1.2.16 - Force mime types in web browser as some users may not have it correct in their registry.
290
292
  * 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
@@ -262,6 +262,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
262
262
 
263
263
  # Revisions
264
264
 
265
+ * 1.2.20 - Fixed up path issue for web browser launch for hot reload.
265
266
  * 1.2.19 - Compilation failure now overwrites the index.html file with error message.
266
267
  * 1.2.16 - Force mime types in web browser as some users may not have it correct in their registry.
267
268
  * 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
@@ -21,6 +21,7 @@ dependencies = [
21
21
  "rapidfuzz>=3.10.1",
22
22
  "progress>=1.6",
23
23
  "Flask>=3.0.0",
24
+ "livereload",
24
25
  ]
25
26
 
26
27
  dynamic = ["version"]
@@ -15,7 +15,7 @@ from .types import BuildMode, CompileResult, CompileServerError
15
15
  # IMPORTANT! There's a bug in github which will REJECT any version update
16
16
  # that has any other change in the repo. Please bump the version as the
17
17
  # ONLY change in a commit, or else the pypi update and the release will fail.
18
- __version__ = "1.2.19"
18
+ __version__ = "1.2.21"
19
19
 
20
20
 
21
21
  class Api:
@@ -184,7 +184,9 @@ class Docker:
184
184
  )
185
185
  else:
186
186
  print(f"Cloning {url} into {output_dir}")
187
- subprocess.run(["git", "clone", url, str(output_dir)], check=True)
187
+ subprocess.run(
188
+ ["git", "clone", "--depth", "1", url, str(output_dir)], check=True
189
+ )
188
190
 
189
191
  dockerfile_path = (
190
192
  output_dir / "src" / "platforms" / "wasm" / "compiler" / "Dockerfile"
@@ -317,7 +319,7 @@ class Test:
317
319
  @staticmethod
318
320
  def spawn_http_server(
319
321
  directory: Path | str = Path("."),
320
- port: int = 8000,
322
+ port: int | None = None,
321
323
  open_browser: bool = True,
322
324
  ) -> Process:
323
325
  from fastled.open_browser import open_browser_process
@@ -81,7 +81,12 @@ class CompileServer:
81
81
  return self.impl._start()
82
82
 
83
83
  def stop(self) -> None:
84
- return self.impl.stop()
84
+ try:
85
+ return self.impl.stop()
86
+ except KeyboardInterrupt:
87
+ import _thread
88
+
89
+ _thread.interrupt_main()
85
90
 
86
91
  def process_running(self) -> bool:
87
92
  return self.impl.process_running()
@@ -1,5 +1,8 @@
1
+ import socket
1
2
  import subprocess
2
3
  import sys
4
+ import time
5
+ import webbrowser
3
6
  from multiprocessing import Process
4
7
  from pathlib import Path
5
8
 
@@ -21,8 +24,6 @@ def open_http_server_subprocess(
21
24
  "--port",
22
25
  str(port),
23
26
  ]
24
- if not open_browser:
25
- cmd.append("--no-browser")
26
27
  # return subprocess.Popen(cmd) # type ignore
27
28
  # pipe stderr and stdout to null
28
29
  subprocess.run(
@@ -36,16 +37,54 @@ def open_http_server_subprocess(
36
37
  _thread.interrupt_main()
37
38
 
38
39
 
40
+ def is_port_free(port: int) -> bool:
41
+ """Check if a port is free"""
42
+ import socket
43
+
44
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
45
+ return s.connect_ex(("localhost", port)) != 0
46
+
47
+
48
+ def find_free_port(start_port: int) -> int:
49
+ """Find a free port starting at start_port"""
50
+ for port in range(start_port, start_port + 100):
51
+ if is_port_free(port):
52
+ print(f"Found free port: {port}")
53
+ return port
54
+ else:
55
+ print(f"Port {port} is in use, finding next")
56
+ raise ValueError("Could not find a free port")
57
+
58
+
59
+ def wait_for_server(port: int, timeout: int = 10) -> None:
60
+ """Wait for the server to start."""
61
+ future_time = time.time() + timeout
62
+ while future_time > time.time():
63
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
64
+ if sock.connect_ex(("localhost", port)) == 0:
65
+ return
66
+ raise TimeoutError("Could not connect to server")
67
+
68
+
39
69
  def open_browser_process(
40
- fastled_js: Path, port: int = DEFAULT_PORT, open_browser: bool = True
70
+ fastled_js: Path, port: int | None = None, open_browser: bool = True
41
71
  ) -> Process:
42
72
  """Start livereload server in the fastled_js directory and return the process"""
73
+ if port is not None:
74
+ if not is_port_free(port):
75
+ raise ValueError(f"Port {port} was specified but in use in use")
76
+ else:
77
+ port = find_free_port(DEFAULT_PORT)
43
78
  out: Process = Process(
44
79
  target=open_http_server_subprocess,
45
80
  args=(fastled_js, port, open_browser),
46
81
  daemon=True,
47
82
  )
48
83
  out.start()
84
+ wait_for_server(port)
85
+ if open_browser:
86
+ print(f"Opening browser to http://localhost:{port}")
87
+ webbrowser.open(url=f"http://localhost:{port}", new=1, autoraise=True)
49
88
  return out
50
89
 
51
90
 
@@ -1,8 +1,7 @@
1
1
  import argparse
2
- import socket
3
- import time
4
2
  from pathlib import Path
5
- from threading import Thread
3
+
4
+ from livereload import Server
6
5
 
7
6
 
8
7
  def _run_flask_server(fastled_js: Path, port: int) -> None:
@@ -12,6 +11,9 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
12
11
 
13
12
  app = Flask(__name__)
14
13
 
14
+ # Must be a full path or flask will fail to find the file.
15
+ fastled_js = fastled_js.resolve()
16
+
15
17
  @app.route("/")
16
18
  def serve_index():
17
19
  return send_from_directory(fastled_js, "index.html")
@@ -49,7 +51,13 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
49
51
  response.headers["Expires"] = "0"
50
52
  return response
51
53
 
52
- app.run(port=port, debug=True)
54
+ server = Server(app.wsgi_app)
55
+ # Watch index.html for changes
56
+ server.watch(str(fastled_js / "index.html"))
57
+ # server.watch(str(fastled_js / "index.js"))
58
+ # server.watch(str(fastled_js / "index.css"))
59
+ # Start the server
60
+ server.serve(port=port, debug=True)
53
61
  except KeyboardInterrupt:
54
62
  import _thread
55
63
 
@@ -61,33 +69,13 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
61
69
  _thread.interrupt_main()
62
70
 
63
71
 
64
- def wait_for_server(port: int, timeout: int = 10) -> None:
65
- """Wait for the server to start."""
66
- future_time = time.time() + timeout
67
- while future_time > time.time():
68
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
69
- if sock.connect_ex(("localhost", port)) == 0:
70
- return
71
- raise TimeoutError("Could not connect to server")
72
-
73
-
74
- def wait_for_server_then_launch_browser(port: int) -> None:
75
- """Wait for the server to start, then launch the browser."""
76
- wait_for_server(port)
77
- import webbrowser
78
-
79
- webbrowser.open(f"http://localhost:{port}")
80
-
81
-
82
- def run(path: Path, port: int, open_browser: bool) -> None:
72
+ def run(path: Path, port: int) -> None:
83
73
  """Run the Flask server."""
84
74
  try:
85
- if open_browser:
86
- browser_thread = Thread(
87
- target=wait_for_server_then_launch_browser, args=(port,), daemon=True
88
- )
89
- browser_thread.start()
90
75
  _run_flask_server(path, port)
76
+ import warnings
77
+
78
+ warnings.warn("Flask server has stopped")
91
79
  except KeyboardInterrupt:
92
80
  import _thread
93
81
 
@@ -110,19 +98,13 @@ def parse_args() -> argparse.Namespace:
110
98
  required=True,
111
99
  help="Port to run the server on (default: %(default)s)",
112
100
  )
113
- parser.add_argument(
114
- "--no-browser",
115
- action="store_true",
116
- help="Do not open the browser",
117
- )
118
101
  return parser.parse_args()
119
102
 
120
103
 
121
104
  def main() -> None:
122
105
  """Main function."""
123
106
  args = parse_args()
124
- open_browser = not args.no_browser
125
- run(args.fastled_js, args.port, open_browser)
107
+ run(args.fastled_js, args.port)
126
108
 
127
109
 
128
110
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.2.19
3
+ Version: 1.2.21
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -20,6 +20,7 @@ Requires-Dist: appdirs>=1.4.4
20
20
  Requires-Dist: rapidfuzz>=3.10.1
21
21
  Requires-Dist: progress>=1.6
22
22
  Requires-Dist: Flask>=3.0.0
23
+ Requires-Dist: livereload
23
24
 
24
25
  # FastLED Wasm compiler
25
26
 
@@ -285,6 +286,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
285
286
 
286
287
  # Revisions
287
288
 
289
+ * 1.2.20 - Fixed up path issue for web browser launch for hot reload.
288
290
  * 1.2.19 - Compilation failure now overwrites the index.html file with error message.
289
291
  * 1.2.16 - Force mime types in web browser as some users may not have it correct in their registry.
290
292
  * 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
@@ -8,3 +8,4 @@ appdirs>=1.4.4
8
8
  rapidfuzz>=3.10.1
9
9
  progress>=1.6
10
10
  Flask>=3.0.0
11
+ livereload
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
File without changes