fastled 1.2.78__py3-none-any.whl → 1.2.80__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 +7 -2
- fastled/client_server.py +12 -1
- fastled/open_browser.py +5 -3
- fastled/parse_args.py +3 -0
- fastled/server_flask.py +39 -5
- fastled/server_start.py +21 -8
- {fastled-1.2.78.dist-info → fastled-1.2.80.dist-info}/METADATA +1 -1
- {fastled-1.2.78.dist-info → fastled-1.2.80.dist-info}/RECORD +12 -12
- {fastled-1.2.78.dist-info → fastled-1.2.80.dist-info}/WHEEL +0 -0
- {fastled-1.2.78.dist-info → fastled-1.2.80.dist-info}/entry_points.txt +0 -0
- {fastled-1.2.78.dist-info → fastled-1.2.80.dist-info}/licenses/LICENSE +0 -0
- {fastled-1.2.78.dist-info → fastled-1.2.80.dist-info}/top_level.txt +0 -0
fastled/__init__.py
CHANGED
@@ -14,7 +14,7 @@ from .types import BuildMode, CompileResult, CompileServerError
|
|
14
14
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
15
15
|
# that has any other change in the repo. Please bump the version as the
|
16
16
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
17
|
-
__version__ = "1.2.
|
17
|
+
__version__ = "1.2.80"
|
18
18
|
|
19
19
|
|
20
20
|
class Api:
|
@@ -194,14 +194,19 @@ class Test:
|
|
194
194
|
def spawn_http_server(
|
195
195
|
directory: Path | str = Path("."),
|
196
196
|
port: int | None = None,
|
197
|
+
compile_server_port: int | None = None,
|
197
198
|
open_browser: bool = True,
|
198
199
|
) -> Process:
|
199
200
|
from fastled.open_browser import open_browser_process
|
200
201
|
|
202
|
+
compile_server_port = compile_server_port or -1
|
201
203
|
if isinstance(directory, str):
|
202
204
|
directory = Path(directory)
|
203
205
|
proc: Process = open_browser_process(
|
204
|
-
directory,
|
206
|
+
directory,
|
207
|
+
port=port,
|
208
|
+
compile_server_port=compile_server_port,
|
209
|
+
open_browser=open_browser,
|
205
210
|
)
|
206
211
|
return proc
|
207
212
|
|
fastled/client_server.py
CHANGED
@@ -188,6 +188,15 @@ def run_client(
|
|
188
188
|
return DEFAULT_URL
|
189
189
|
|
190
190
|
url = get_url()
|
191
|
+
# parse out the port from the url
|
192
|
+
# use a standard host address parser to grab it
|
193
|
+
import urllib.parse
|
194
|
+
|
195
|
+
parsed_url = urllib.parse.urlparse(url)
|
196
|
+
if parsed_url.port is not None:
|
197
|
+
port = parsed_url.port
|
198
|
+
else:
|
199
|
+
port = 80
|
191
200
|
|
192
201
|
try:
|
193
202
|
|
@@ -214,7 +223,9 @@ def run_client(
|
|
214
223
|
|
215
224
|
browser_proc: Process | None = None
|
216
225
|
if open_web_browser:
|
217
|
-
browser_proc = open_browser_process(
|
226
|
+
browser_proc = open_browser_process(
|
227
|
+
directory / "fastled_js", compile_server_port=port
|
228
|
+
)
|
218
229
|
else:
|
219
230
|
print("\nCompilation successful.")
|
220
231
|
if compile_server:
|
fastled/open_browser.py
CHANGED
@@ -14,8 +14,7 @@ PYTHON_EXE = sys.executable
|
|
14
14
|
|
15
15
|
|
16
16
|
def _open_http_server_subprocess(
|
17
|
-
fastled_js: Path,
|
18
|
-
port: int,
|
17
|
+
fastled_js: Path, port: int, compile_server_port: int
|
19
18
|
) -> None:
|
20
19
|
print("\n################################################################")
|
21
20
|
print(f"# Opening browser to {fastled_js} on port {port}")
|
@@ -30,6 +29,8 @@ def _open_http_server_subprocess(
|
|
30
29
|
str(fastled_js),
|
31
30
|
"--port",
|
32
31
|
str(port),
|
32
|
+
"--compile-server-port",
|
33
|
+
str(compile_server_port),
|
33
34
|
]
|
34
35
|
# Pass SSL flags if available
|
35
36
|
if ssl:
|
@@ -89,6 +90,7 @@ def wait_for_server(port: int, timeout: int = 10) -> None:
|
|
89
90
|
|
90
91
|
def open_browser_process(
|
91
92
|
fastled_js: Path,
|
93
|
+
compile_server_port: int,
|
92
94
|
port: int | None = None,
|
93
95
|
open_browser: bool = True,
|
94
96
|
) -> Process:
|
@@ -100,7 +102,7 @@ def open_browser_process(
|
|
100
102
|
|
101
103
|
proc = Process(
|
102
104
|
target=_open_http_server_subprocess,
|
103
|
-
args=(fastled_js, port),
|
105
|
+
args=(fastled_js, port, compile_server_port),
|
104
106
|
daemon=True,
|
105
107
|
)
|
106
108
|
proc.start()
|
fastled/parse_args.py
CHANGED
@@ -188,6 +188,9 @@ def parse_args() -> Args:
|
|
188
188
|
if not args.build:
|
189
189
|
print("Adding --build flag when using --interactive")
|
190
190
|
args.build = True
|
191
|
+
user_wants_update = args.update
|
192
|
+
if user_wants_update is not True:
|
193
|
+
args.no_auto_updates = True
|
191
194
|
return Args.from_namespace(args)
|
192
195
|
|
193
196
|
if not args.update:
|
fastled/server_flask.py
CHANGED
@@ -2,12 +2,14 @@ import argparse
|
|
2
2
|
from multiprocessing import Process
|
3
3
|
from pathlib import Path
|
4
4
|
|
5
|
+
import requests
|
5
6
|
from livereload import Server
|
6
7
|
|
7
8
|
|
8
9
|
def _run_flask_server(
|
9
10
|
fastled_js: Path,
|
10
11
|
port: int,
|
12
|
+
compile_server_port: int,
|
11
13
|
certfile: Path | None = None,
|
12
14
|
keyfile: Path | None = None,
|
13
15
|
) -> None:
|
@@ -27,10 +29,38 @@ def _run_flask_server(
|
|
27
29
|
# Must be a full path or flask will fail to find the file.
|
28
30
|
fastled_js = fastled_js.resolve()
|
29
31
|
|
32
|
+
print(f"Compile server port is at {compile_server_port}")
|
33
|
+
|
30
34
|
@app.route("/")
|
31
35
|
def serve_index():
|
32
36
|
return send_from_directory(fastled_js, "index.html")
|
33
37
|
|
38
|
+
@app.route("/static/<path:path>")
|
39
|
+
def proxy_static(path):
|
40
|
+
"""Proxy requests to /static/* to the compile server"""
|
41
|
+
from flask import Response, request
|
42
|
+
|
43
|
+
# Forward the request to the compile server
|
44
|
+
target_url = f"http://localhost:{compile_server_port}/static/{path}"
|
45
|
+
|
46
|
+
# Forward the request with the same method, headers, and body
|
47
|
+
resp = requests.request(
|
48
|
+
method=request.method,
|
49
|
+
url=target_url,
|
50
|
+
headers={key: value for key, value in request.headers if key != "Host"},
|
51
|
+
data=request.get_data(),
|
52
|
+
cookies=request.cookies,
|
53
|
+
allow_redirects=True,
|
54
|
+
stream=False,
|
55
|
+
)
|
56
|
+
|
57
|
+
# Create a Flask Response object from the requests response
|
58
|
+
response = Response(
|
59
|
+
resp.raw.read(), status=resp.status_code, headers=dict(resp.headers)
|
60
|
+
)
|
61
|
+
|
62
|
+
return response
|
63
|
+
|
34
64
|
@app.route("/<path:path>")
|
35
65
|
def serve_files(path):
|
36
66
|
response = send_from_directory(fastled_js, path)
|
@@ -83,11 +113,15 @@ def _run_flask_server(
|
|
83
113
|
|
84
114
|
|
85
115
|
def run(
|
86
|
-
port: int,
|
116
|
+
port: int,
|
117
|
+
cwd: Path,
|
118
|
+
compile_server_port: int,
|
119
|
+
certfile: Path | None = None,
|
120
|
+
keyfile: Path | None = None,
|
87
121
|
) -> None:
|
88
122
|
"""Run the Flask server."""
|
89
123
|
try:
|
90
|
-
_run_flask_server(cwd, port, certfile, keyfile)
|
124
|
+
_run_flask_server(cwd, port, compile_server_port, certfile, keyfile)
|
91
125
|
import warnings
|
92
126
|
|
93
127
|
warnings.warn("Flask server has stopped")
|
@@ -128,15 +162,15 @@ def parse_args() -> argparse.Namespace:
|
|
128
162
|
|
129
163
|
def run_flask_server_process(
|
130
164
|
port: int,
|
131
|
-
cwd: Path
|
165
|
+
cwd: Path,
|
166
|
+
compile_server_port: int,
|
132
167
|
certfile: Path | None = None,
|
133
168
|
keyfile: Path | None = None,
|
134
169
|
) -> Process:
|
135
170
|
"""Run the Flask server in a separate process."""
|
136
|
-
cwd = cwd or Path(".")
|
137
171
|
process = Process(
|
138
172
|
target=run,
|
139
|
-
args=(port, cwd, certfile, keyfile),
|
173
|
+
args=(port, cwd, compile_server_port, certfile, keyfile),
|
140
174
|
)
|
141
175
|
process.start()
|
142
176
|
return process
|
fastled/server_start.py
CHANGED
@@ -9,7 +9,11 @@ from fastled.server_flask import run_flask_server_process
|
|
9
9
|
|
10
10
|
|
11
11
|
def run_server_process(
|
12
|
-
port: int,
|
12
|
+
port: int,
|
13
|
+
cwd: Path,
|
14
|
+
compile_server_port: int,
|
15
|
+
certfile: Path | None = None,
|
16
|
+
keyfile: Path | None = None,
|
13
17
|
) -> Process:
|
14
18
|
"""Run the server in a separate process."""
|
15
19
|
if True:
|
@@ -17,6 +21,7 @@ def run_server_process(
|
|
17
21
|
process = run_flask_server_process(
|
18
22
|
port=port,
|
19
23
|
cwd=cwd,
|
24
|
+
compile_server_port=compile_server_port,
|
20
25
|
certfile=certfile,
|
21
26
|
keyfile=keyfile,
|
22
27
|
)
|
@@ -45,19 +50,18 @@ def get_asset_path(filename: str) -> Path | None:
|
|
45
50
|
def start_process(
|
46
51
|
path: Path,
|
47
52
|
port: int,
|
48
|
-
|
49
|
-
|
53
|
+
compile_server_port: int,
|
54
|
+
certfile: Path | None = None, # reserved for future use
|
55
|
+
keyfile: Path | None = None, # reserved for future use
|
50
56
|
) -> Process:
|
51
57
|
"""Run the server, using package assets if explicit paths are not provided"""
|
52
58
|
# Use package resources if no explicit path
|
53
|
-
if certfile is None:
|
54
|
-
certfile = get_asset_path("localhost.pem")
|
55
|
-
if keyfile is None:
|
56
|
-
keyfile = get_asset_path("localhost-key.pem")
|
57
59
|
|
58
60
|
# _run_flask_server(path, port, certfile, keyfile)
|
59
61
|
# run_fastapi_server_process(port=port, path=path, certfile=certfile, keyfile=keyfile)
|
60
|
-
proc = run_server_process(
|
62
|
+
proc = run_server_process(
|
63
|
+
port=port, cwd=path, compile_server_port=compile_server_port
|
64
|
+
)
|
61
65
|
# try:
|
62
66
|
# proc.join()
|
63
67
|
# except KeyboardInterrupt:
|
@@ -71,6 +75,7 @@ def start_process(
|
|
71
75
|
class Args:
|
72
76
|
fastled_js: Path
|
73
77
|
port: int
|
78
|
+
compile_server_port: int
|
74
79
|
cert: Path | None
|
75
80
|
key: Path | None
|
76
81
|
|
@@ -89,6 +94,12 @@ def parse_args() -> Args:
|
|
89
94
|
default=5500,
|
90
95
|
help="Port to run the server on (default: 5500)",
|
91
96
|
)
|
97
|
+
parser.add_argument(
|
98
|
+
"--compile-server-port",
|
99
|
+
type=int,
|
100
|
+
required=True,
|
101
|
+
help="Used to forward requests to the compile server",
|
102
|
+
)
|
92
103
|
parser.add_argument(
|
93
104
|
"--cert", type=Path, help="(Optional) Path to SSL certificate (PEM format)"
|
94
105
|
)
|
@@ -99,6 +110,7 @@ def parse_args() -> Args:
|
|
99
110
|
out: Args = Args(
|
100
111
|
fastled_js=args.fastled_js,
|
101
112
|
port=args.port,
|
113
|
+
compile_server_port=args.compile_server_port,
|
102
114
|
cert=args.cert,
|
103
115
|
key=args.key,
|
104
116
|
)
|
@@ -116,6 +128,7 @@ def main() -> None:
|
|
116
128
|
proc = start_process(
|
117
129
|
path=fastled_js,
|
118
130
|
port=port,
|
131
|
+
compile_server_port=args.compile_server_port,
|
119
132
|
certfile=cert,
|
120
133
|
keyfile=key,
|
121
134
|
)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=yIAkMRI7Rv2hmTe-0r8VSV-sAkdZTUxJ9dGUD8mUL00,6862
|
2
2
|
fastled/app.py,sha256=0W8Mbplo5UCRzj7nMVgkmCBddQGufsUQjkUUT4pMp74,4611
|
3
3
|
fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
|
4
4
|
fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
|
5
5
|
fastled/cli_test_interactive.py,sha256=BjNhveZOk5aCffHbcrxPQQjWmAuj4ClVKKcKX5eY6yM,542
|
6
|
-
fastled/client_server.py,sha256=
|
6
|
+
fastled/client_server.py,sha256=zQF4ioOkQzHkKAP0A-8mqjVt8aGD9Sj9ijmknsdLW0U,14859
|
7
7
|
fastled/compile_server.py,sha256=rkXvrvdav5vDG8lv_OlBX3YSCHtnHMt25nXbfeg_r78,2960
|
8
8
|
fastled/compile_server_impl.py,sha256=_DRdt-eWTdOr2mXvO7h6dKqDSonsm523bIqCZr4wf2k,12615
|
9
9
|
fastled/docker_manager.py,sha256=SC_qV6grNTGh0QD1ubKrULQblrN-2PORocISlaZg9NQ,35156
|
@@ -11,16 +11,16 @@ fastled/filewatcher.py,sha256=3qS3L7zMQhFuVrkeGn1djsB_cB6x_E2YGJmmQWVAU_w,10033
|
|
11
11
|
fastled/keyboard.py,sha256=UTAsqCn1UMYnB8YDzENiLTj4GeL45tYfEcO7_5fLFEg,3556
|
12
12
|
fastled/keyz.py,sha256=LO-8m_7CpNDiZLM-FXhQ30f9gN1bUYz5lOsUPTIbI-c,4020
|
13
13
|
fastled/live_client.py,sha256=MDauol0mxtXggV1Pv9ahC0Jjg_4wnnV6FjGEtdd9cxU,2763
|
14
|
-
fastled/open_browser.py,sha256=
|
15
|
-
fastled/parse_args.py,sha256=
|
14
|
+
fastled/open_browser.py,sha256=6Iu1hVve0g1Hy4L0DcInmZJfeMM5-Dqcwlv9UqfCtCg,3983
|
15
|
+
fastled/parse_args.py,sha256=waNeATOEz8D50Py5-9p6HcVSa21piTOAWOXS3ag8PYo,9428
|
16
16
|
fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
|
17
17
|
fastled/print_filter.py,sha256=ZpebuqfWEraSBD3Dm0PVZhQVBnU_NSILniwBHwjC1qM,2342
|
18
18
|
fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
|
19
19
|
fastled/select_sketch_directory.py,sha256=-eudwCns3AKj4HuHtSkZAFwbnf005SNL07pOzs9VxnE,1383
|
20
20
|
fastled/server_fastapi.py,sha256=ytsL4poO-yugDIhvYJq6nCNdLZ4fQJ1AFqXkF-uEkqo,1488
|
21
21
|
fastled/server_fastapi_cli.py,sha256=fJGLvbJx5ertsZER_lgg0GfkYTX-V2rxzbNO1lEapU0,1392
|
22
|
-
fastled/server_flask.py,sha256=
|
23
|
-
fastled/server_start.py,sha256=
|
22
|
+
fastled/server_flask.py,sha256=Temr1H-JXMOo0KGOs21BYRz0F7shH6Dsh_7T_bVRpsM,5851
|
23
|
+
fastled/server_start.py,sha256=muMreRRYvjme-gETWDWzmT4mRGAXpDJkFy_oJ0lJZFY,3895
|
24
24
|
fastled/settings.py,sha256=oezRvRUJWwauO-kpC4LDbKg6Q-ij4d09UtR2vkjSAPU,575
|
25
25
|
fastled/sketch.py,sha256=tHckjDj8P6BI_LWzUFM071a9qcqPs-r-qFWIe50P5Xw,3391
|
26
26
|
fastled/spinner.py,sha256=VHxmvB92P0Z_zYxRajb5HiNmkHHvZ5dG7hKtZltzpcs,867
|
@@ -35,9 +35,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
|
|
35
35
|
fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
|
36
36
|
fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
|
37
37
|
fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
|
38
|
-
fastled-1.2.
|
39
|
-
fastled-1.2.
|
40
|
-
fastled-1.2.
|
41
|
-
fastled-1.2.
|
42
|
-
fastled-1.2.
|
43
|
-
fastled-1.2.
|
38
|
+
fastled-1.2.80.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
39
|
+
fastled-1.2.80.dist-info/METADATA,sha256=jAnVkAuPkXEoU6dKzqjSu2phFz6WgwsFfvuILLfAuyo,22065
|
40
|
+
fastled-1.2.80.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
41
|
+
fastled-1.2.80.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
42
|
+
fastled-1.2.80.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
|
43
|
+
fastled-1.2.80.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|