fastled 1.2.80__py3-none-any.whl → 1.2.81__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
@@ -9,12 +9,12 @@ from .compile_server import CompileServer
9
9
  from .live_client import LiveClient
10
10
  from .settings import DOCKER_FILE, IMAGE_NAME
11
11
  from .site.build import build
12
- from .types import BuildMode, CompileResult, CompileServerError
12
+ from .types import BuildMode, CompileResult, CompileServerError, FileResponse
13
13
 
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.80"
17
+ __version__ = "1.2.81"
18
18
 
19
19
 
20
20
  class Api:
@@ -218,5 +218,6 @@ __all__ = [
218
218
  "CompileResult",
219
219
  "CompileServerError",
220
220
  "BuildMode",
221
+ "FileResponse",
221
222
  "DOCKER_FILE",
222
223
  ]
fastled/compile_server.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
- from fastled.types import BuildMode, CompileResult, Platform
3
+ from fastled.types import BuildMode, CompileResult, FileResponse, Platform
4
4
 
5
5
 
6
6
  class CompileServer:
@@ -53,6 +53,10 @@ class CompileServer:
53
53
 
54
54
  project_init(example=example, outputdir=outputdir)
55
55
 
56
+ def fetch_source_file(self, filepath: str) -> FileResponse | Exception:
57
+ """Get the source file from the server."""
58
+ return self.impl.fetch_source_file(filepath)
59
+
56
60
  @property
57
61
  def name(self) -> str:
58
62
  return self.impl.container_name
@@ -17,7 +17,7 @@ from fastled.docker_manager import (
17
17
  )
18
18
  from fastled.settings import DEFAULT_CONTAINER_NAME, IMAGE_NAME, SERVER_PORT
19
19
  from fastled.sketch import looks_like_fastled_repo
20
- from fastled.types import BuildMode, CompileResult, CompileServerError
20
+ from fastled.types import BuildMode, CompileResult, CompileServerError, FileResponse
21
21
 
22
22
  SERVER_OPTIONS = [
23
23
  "--allow-shutdown", # Allow the server to be shut down without a force kill.
@@ -204,6 +204,29 @@ class CompileServerImpl:
204
204
  return False
205
205
  return False
206
206
 
207
+ def fetch_source_file(self, filepath: str) -> FileResponse | Exception:
208
+ """Get the source file from the server."""
209
+ if not self._port:
210
+ raise RuntimeError("Server has not been started yet")
211
+ try:
212
+ httpx_client = httpx.Client()
213
+ url = f"http://localhost:{self._port}/sourcefiles/{filepath}"
214
+ response = httpx_client.get(url, follow_redirects=True)
215
+ if response.status_code == 200:
216
+ content = response.text
217
+ mimetype: str = response.headers.get("Content-Type", "text/plain")
218
+ return FileResponse(
219
+ content=content,
220
+ mimetype=mimetype,
221
+ filename=filepath,
222
+ )
223
+ else:
224
+ return CompileServerError(
225
+ f"Error fetching file {filepath}: {response.status_code}"
226
+ )
227
+ except httpx.RequestError as e:
228
+ return CompileServerError(f"Error fetching file {filepath}: {e}")
229
+
207
230
  def _start(self) -> int:
208
231
  print("Compiling server starting")
209
232
 
fastled/types.py CHANGED
@@ -151,3 +151,12 @@ class Platform(Enum):
151
151
  raise ValueError(
152
152
  f"Platform must be one of {valid_modes}, got {platform_str}"
153
153
  )
154
+
155
+
156
+ @dataclass
157
+ class FileResponse:
158
+ """File response from the server."""
159
+
160
+ filename: str
161
+ content: str
162
+ mimetype: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.2.80
3
+ Version: 1.2.81
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -1,11 +1,11 @@
1
- fastled/__init__.py,sha256=yIAkMRI7Rv2hmTe-0r8VSV-sAkdZTUxJ9dGUD8mUL00,6862
1
+ fastled/__init__.py,sha256=E0yN78HV0eXNtDsCcsGLoJTTdhAaXlsN6B17h7nzmjc,6896
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
6
  fastled/client_server.py,sha256=zQF4ioOkQzHkKAP0A-8mqjVt8aGD9Sj9ijmknsdLW0U,14859
7
- fastled/compile_server.py,sha256=rkXvrvdav5vDG8lv_OlBX3YSCHtnHMt25nXbfeg_r78,2960
8
- fastled/compile_server_impl.py,sha256=_DRdt-eWTdOr2mXvO7h6dKqDSonsm523bIqCZr4wf2k,12615
7
+ fastled/compile_server.py,sha256=sRiXYzw7lv9vcWJWGPUkzOGZPmvZGV_TGwbHYoRc15s,3155
8
+ fastled/compile_server_impl.py,sha256=0xWJg5b6n_Y-BKPI2ToG4bT7bB_ZuGNQy45JjyJDg6o,13659
9
9
  fastled/docker_manager.py,sha256=SC_qV6grNTGh0QD1ubKrULQblrN-2PORocISlaZg9NQ,35156
10
10
  fastled/filewatcher.py,sha256=3qS3L7zMQhFuVrkeGn1djsB_cB6x_E2YGJmmQWVAU_w,10033
11
11
  fastled/keyboard.py,sha256=UTAsqCn1UMYnB8YDzENiLTj4GeL45tYfEcO7_5fLFEg,3556
@@ -25,7 +25,7 @@ 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
27
27
  fastled/string_diff.py,sha256=NbtYxvBFxTUdmTpMLizlgZj2ULJ-7etj72GBdWDTGws,2496
28
- fastled/types.py,sha256=mNchhIW5m6hBBv63OYE0V_u5yGnS505eWjw7HCazb_s,4694
28
+ fastled/types.py,sha256=k1j1y5h1zpRonp1mqRXy797mSbLqzf5K1QEgl8f27jQ,4822
29
29
  fastled/util.py,sha256=17f2A52TfBErJOEGC_Vs72t1mTDocLVTfnR9hWbXW8A,501
30
30
  fastled/web_compile.py,sha256=QTYHtcm55zsFxPhdA-qSPfL5Q4lhL3h3oNmir3m-Y3s,11345
31
31
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
@@ -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.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,,
38
+ fastled-1.2.81.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
39
+ fastled-1.2.81.dist-info/METADATA,sha256=dJ5jrJBU_ZPYVPE9HHC6S_61BN3-PxC297TXvEpYorc,22065
40
+ fastled-1.2.81.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
41
+ fastled-1.2.81.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
42
+ fastled-1.2.81.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
43
+ fastled-1.2.81.dist-info/RECORD,,