fastled 1.3.10__py3-none-any.whl → 1.3.12__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/__version__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # IMPORTANT! There's a bug in github which will REJECT any version update
2
2
  # that has any other change in the repo. Please bump the version as the
3
3
  # ONLY change in a commit, or else the pypi update and the release will fail.
4
- __version__ = "1.3.10"
4
+ __version__ = "1.3.12"
5
5
 
6
6
  __version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
fastled/app.py CHANGED
@@ -1,182 +1,177 @@
1
- """
2
- Uses the latest wasm compiler image to compile the FastLED sketch.
3
- """
4
-
5
- import sys
6
- import time
7
- from pathlib import Path
8
-
9
- from fastled.client_server import run_client_server
10
- from fastled.compile_server import CompileServer
11
- from fastled.filewatcher import file_watcher_set
12
- from fastled.parse_args import Args, parse_args
13
- from fastled.sketch import find_sketch_directories, looks_like_fastled_repo
14
-
15
- # from fastled.sketch import (
16
- # find_sketch_directories,
17
- # looks_like_fastled_repo,
18
- # looks_like_sketch_directory,
19
- # )
20
-
21
-
22
- def run_server(args: Args) -> int:
23
- interactive = args.interactive
24
- auto_update = args.auto_update
25
- mapped_dir = Path(args.directory).absolute() if args.directory else None
26
- if interactive and mapped_dir is None:
27
- print("Select a sketch when you enter interactive mode.")
28
- return 1
29
- compile_server = CompileServer(
30
- interactive=interactive,
31
- auto_updates=auto_update,
32
- mapped_dir=mapped_dir,
33
- auto_start=True,
34
- remove_previous=args.clear,
35
- )
36
-
37
- if not interactive:
38
- print(f"Server started at {compile_server.url()}")
39
- try:
40
- while True:
41
- if not compile_server.process_running():
42
- print("Server process is not running. Exiting...")
43
- return 1
44
- time.sleep(0.1)
45
- except KeyboardInterrupt:
46
- print("\nExiting from server...")
47
- return 1
48
- finally:
49
- compile_server.stop()
50
- return 0
51
-
52
-
53
- def main() -> int:
54
- from fastled import __version__
55
- from fastled.select_sketch_directory import select_sketch_directory
56
-
57
- args = parse_args()
58
- interactive: bool = args.interactive
59
- has_server = args.server
60
- update: bool = args.update
61
- build: bool = args.build
62
- just_compile: bool = args.just_compile
63
- # directory: Path | None = Path(args.directory).absolute() if args.directory else None
64
- directory: Path | None = Path(args.directory) if args.directory else None
65
- cwd_looks_like_fastled_repo = looks_like_fastled_repo()
66
-
67
- # now it is safe to print out the version
68
- print(f"FastLED version: {__version__}")
69
-
70
- # Resolve some of the last interactive arguments
71
- # 1. If interactive is set and the sketch directory is not given,
72
- # then prompt the user for a sketch directory.
73
- # 2. Tell the user they can use --server --interactive to
74
- # skip this prompt.
75
- if interactive and cwd_looks_like_fastled_repo and directory is None:
76
- answer = input(
77
- "No sketch directory selected, would you like to select one? (y/n): "
78
- )
79
- if answer.lower()[:1] == "y" or answer.lower() == "":
80
- sketch_list: list[Path] = find_sketch_directories()
81
- if sketch_list:
82
- maybe_dir: str | None = select_sketch_directory(
83
- sketch_list, cwd_looks_like_fastled_repo
84
- )
85
- if maybe_dir is not None:
86
- directory = Path(maybe_dir)
87
- if not directory.exists():
88
- print(
89
- f"Directory {directory} does not exist, entering interactive mode without project mapped in."
90
- )
91
- directory = None
92
-
93
- if update:
94
- # Force auto_update to ensure update check happens
95
- compile_server = CompileServer(interactive=False, auto_updates=True)
96
- compile_server.stop()
97
- print("Finished updating.")
98
- return 0
99
-
100
- if build:
101
- print("Building is disabled")
102
- build = False
103
-
104
- if interactive:
105
- # raise NotImplementedError("Building is not yet supported.")
106
- file_watcher_set(False)
107
- # project_root = Path(".").absolute()
108
- # print(f"Building Docker image at {project_root}")
109
- from fastled import Api
110
-
111
- server: CompileServer = CompileServer(
112
- interactive=interactive,
113
- auto_updates=False,
114
- mapped_dir=directory,
115
- auto_start=False,
116
- remove_previous=args.clear,
117
- )
118
-
119
- server.start(wait_for_startup=False)
120
-
121
- try:
122
- while server.process_running():
123
- # wait for ctrl-c
124
- time.sleep(0.1)
125
- except KeyboardInterrupt:
126
- print("\nExiting from server...")
127
- server.stop()
128
- return 0
129
-
130
- try:
131
- if interactive:
132
- server.stop()
133
- return 0
134
- print(f"Built Docker image: {server.name}")
135
- if not directory:
136
- if not directory:
137
- print("No directory specified")
138
- server.stop()
139
- return 0
140
-
141
- print("Running server")
142
-
143
- with Api.live_client(
144
- auto_updates=False,
145
- sketch_directory=directory,
146
- host=server,
147
- auto_start=True,
148
- keep_running=not just_compile,
149
- ) as _:
150
- while True:
151
- time.sleep(0.2) # wait for user to exit
152
- except KeyboardInterrupt:
153
- print("\nExiting from client...")
154
- server.stop()
155
- return 1
156
-
157
- if has_server:
158
- print("Running in server only mode.")
159
- return run_server(args)
160
- else:
161
- print("Running in client/server mode.")
162
- return run_client_server(args)
163
-
164
-
165
- if __name__ == "__main__":
166
- # Note that the entry point for the exe is in cli.py
167
- try:
168
- # sys.argv.append("-i")
169
- # sys.argv.append("-b")
170
- # sys.argv.append("examples/wasm")
171
- # sys.argv.append()
172
- import os
173
-
174
- os.chdir("../fastled")
175
- sys.argv.append("examples/FxWave2d")
176
- sys.exit(main())
177
- except KeyboardInterrupt:
178
- print("\nExiting from main...")
179
- sys.exit(1)
180
- except Exception as e:
181
- print(f"Error: {e}")
182
- sys.exit(1)
1
+ """
2
+ Uses the latest wasm compiler image to compile the FastLED sketch.
3
+ """
4
+
5
+ import os
6
+ import sys
7
+ import time
8
+ from pathlib import Path
9
+
10
+ from fastled.client_server import run_client_server
11
+ from fastled.compile_server import CompileServer
12
+ from fastled.filewatcher import file_watcher_set
13
+ from fastled.parse_args import Args, parse_args
14
+ from fastled.sketch import find_sketch_directories, looks_like_fastled_repo
15
+
16
+
17
+ def run_server(args: Args) -> int:
18
+ interactive = args.interactive
19
+ auto_update = args.auto_update
20
+ mapped_dir = Path(args.directory).absolute() if args.directory else None
21
+ if interactive and mapped_dir is None:
22
+ print("Select a sketch when you enter interactive mode.")
23
+ return 1
24
+ compile_server = CompileServer(
25
+ interactive=interactive,
26
+ auto_updates=auto_update,
27
+ mapped_dir=mapped_dir,
28
+ auto_start=True,
29
+ remove_previous=args.clear,
30
+ )
31
+
32
+ if not interactive:
33
+ print(f"Server started at {compile_server.url()}")
34
+ try:
35
+ while True:
36
+ if not compile_server.process_running():
37
+ print("Server process is not running. Exiting...")
38
+ return 1
39
+ time.sleep(0.1)
40
+ except KeyboardInterrupt:
41
+ print("\nExiting from server...")
42
+ return 1
43
+ finally:
44
+ compile_server.stop()
45
+ return 0
46
+
47
+
48
+ def main() -> int:
49
+ from fastled import __version__
50
+ from fastled.select_sketch_directory import select_sketch_directory
51
+
52
+ args = parse_args()
53
+ interactive: bool = args.interactive
54
+ has_server = args.server
55
+ update: bool = args.update
56
+ build: bool = args.build
57
+ just_compile: bool = args.just_compile
58
+ # directory: Path | None = Path(args.directory).absolute() if args.directory else None
59
+ directory: Path | None = Path(args.directory) if args.directory else None
60
+ cwd_looks_like_fastled_repo = looks_like_fastled_repo()
61
+
62
+ # now it is safe to print out the version
63
+ print(f"FastLED version: {__version__}")
64
+
65
+ # Resolve some of the last interactive arguments
66
+ # 1. If interactive is set and the sketch directory is not given,
67
+ # then prompt the user for a sketch directory.
68
+ # 2. Tell the user they can use --server --interactive to
69
+ # skip this prompt.
70
+ if interactive and cwd_looks_like_fastled_repo and directory is None:
71
+ answer = input(
72
+ "No sketch directory selected, would you like to select one? (y/n): "
73
+ )
74
+ if answer.lower()[:1] == "y" or answer.lower() == "":
75
+ sketch_list: list[Path] = find_sketch_directories()
76
+ if sketch_list:
77
+ maybe_dir: str | None = select_sketch_directory(
78
+ sketch_list, cwd_looks_like_fastled_repo
79
+ )
80
+ if maybe_dir is not None:
81
+ directory = Path(maybe_dir)
82
+ if not directory.exists():
83
+ print(
84
+ f"Directory {directory} does not exist, entering interactive mode without project mapped in."
85
+ )
86
+ directory = None
87
+
88
+ if update:
89
+ # Force auto_update to ensure update check happens
90
+ compile_server = CompileServer(interactive=False, auto_updates=True)
91
+ compile_server.stop()
92
+ print("Finished updating.")
93
+ return 0
94
+
95
+ if build:
96
+ print("Building is disabled")
97
+ build = False
98
+
99
+ if interactive:
100
+ # raise NotImplementedError("Building is not yet supported.")
101
+ file_watcher_set(False)
102
+ # project_root = Path(".").absolute()
103
+ # print(f"Building Docker image at {project_root}")
104
+ from fastled import Api
105
+
106
+ server: CompileServer = CompileServer(
107
+ interactive=interactive,
108
+ auto_updates=False,
109
+ mapped_dir=directory,
110
+ auto_start=False,
111
+ remove_previous=args.clear,
112
+ )
113
+
114
+ server.start(wait_for_startup=False)
115
+
116
+ try:
117
+ while server.process_running():
118
+ # wait for ctrl-c
119
+ time.sleep(0.1)
120
+ except KeyboardInterrupt:
121
+ print("\nExiting from server...")
122
+ server.stop()
123
+ return 0
124
+
125
+ try:
126
+ if interactive:
127
+ server.stop()
128
+ return 0
129
+ print(f"Built Docker image: {server.name}")
130
+ if not directory:
131
+ if not directory:
132
+ print("No directory specified")
133
+ server.stop()
134
+ return 0
135
+
136
+ print("Running server")
137
+
138
+ with Api.live_client(
139
+ auto_updates=False,
140
+ sketch_directory=directory,
141
+ host=server,
142
+ auto_start=True,
143
+ keep_running=not just_compile,
144
+ ) as _:
145
+ while True:
146
+ time.sleep(0.2) # wait for user to exit
147
+ except KeyboardInterrupt:
148
+ print("\nExiting from client...")
149
+ server.stop()
150
+ return 1
151
+
152
+ if has_server:
153
+ print("Running in server only mode.")
154
+ return run_server(args)
155
+ else:
156
+ print("Running in client/server mode.")
157
+ return run_client_server(args)
158
+
159
+
160
+ if __name__ == "__main__":
161
+ # Note that the entry point for the exe is in cli.py
162
+ try:
163
+ # sys.argv.append("-i")
164
+ # sys.argv.append("-b")
165
+ # sys.argv.append("examples/wasm")
166
+ # sys.argv.append()
167
+ import os
168
+
169
+ os.chdir("../fastled")
170
+ sys.argv.append("examples/FxWave2d")
171
+ sys.exit(main())
172
+ except KeyboardInterrupt:
173
+ print("\nExiting from main...")
174
+ sys.exit(1)
175
+ except Exception as e:
176
+ print(f"Error: {e}")
177
+ sys.exit(1)
fastled/args.py CHANGED
@@ -62,6 +62,7 @@ class Args:
62
62
  assert isinstance(
63
63
  args.release, bool
64
64
  ), f"expected bool, got {type(args.release)}"
65
+
65
66
  init: bool | str = False
66
67
  if args.init is None:
67
68
  init = False
fastled/cli.py CHANGED
@@ -3,7 +3,6 @@ Main entry point.
3
3
  """
4
4
 
5
5
  import multiprocessing
6
- import os
7
6
  import sys
8
7
 
9
8
 
@@ -16,9 +15,9 @@ def run_app() -> int:
16
15
 
17
16
  def main() -> int:
18
17
  """Main entry point for the template_python_cmd package."""
19
- if "--debug" in sys.argv:
20
- # Debug mode
21
- os.environ["FLASK_SERVER_LOGGING"] = "1"
18
+ # if "--debug" in sys.argv:
19
+ # # Debug mode
20
+ # os.environ["FLASK_SERVER_LOGGING"] = "1"
22
21
  return run_app()
23
22
 
24
23