fastled 1.2.80__tar.gz → 1.2.81__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 (133) hide show
  1. {fastled-1.2.80 → fastled-1.2.81}/PKG-INFO +1 -1
  2. {fastled-1.2.80 → fastled-1.2.81}/compiler/compile.py +1 -1
  3. {fastled-1.2.80 → fastled-1.2.81}/compiler/server.py +34 -0
  4. {fastled-1.2.80 → fastled-1.2.81}/docker-compose.yml +2 -1
  5. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/__init__.py +3 -2
  6. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/compile_server.py +5 -1
  7. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/compile_server_impl.py +24 -1
  8. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/types.py +9 -0
  9. {fastled-1.2.80 → fastled-1.2.81}/src/fastled.egg-info/PKG-INFO +1 -1
  10. {fastled-1.2.80 → fastled-1.2.81}/src/fastled.egg-info/SOURCES.txt +2 -0
  11. fastled-1.2.81/tests/unit/test_fastled_source_get.py +32 -0
  12. fastled-1.2.81/tests/unit/test_version.py +27 -0
  13. {fastled-1.2.80 → fastled-1.2.81}/.aiderignore +0 -0
  14. {fastled-1.2.80 → fastled-1.2.81}/.dockerignore +0 -0
  15. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/build_multi_docker_image.yml +0 -0
  16. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/build_webpage.yml +0 -0
  17. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/lint.yml +0 -0
  18. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/publish_release.yml +0 -0
  19. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/template_build_docker_image.yml +0 -0
  20. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/test_build_exe.yml +0 -0
  21. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/test_macos.yml +0 -0
  22. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/test_ubuntu.yml +0 -0
  23. {fastled-1.2.80 → fastled-1.2.81}/.github/workflows/test_win.yml +0 -0
  24. {fastled-1.2.80 → fastled-1.2.81}/.gitignore +0 -0
  25. {fastled-1.2.80 → fastled-1.2.81}/.pylintrc +0 -0
  26. {fastled-1.2.80 → fastled-1.2.81}/.vscode/launch.json +0 -0
  27. {fastled-1.2.80 → fastled-1.2.81}/.vscode/settings.json +0 -0
  28. {fastled-1.2.80 → fastled-1.2.81}/.vscode/tasks.json +0 -0
  29. {fastled-1.2.80 → fastled-1.2.81}/Dockerfile +0 -0
  30. {fastled-1.2.80 → fastled-1.2.81}/LICENSE +0 -0
  31. {fastled-1.2.80 → fastled-1.2.81}/MANIFEST.in +0 -0
  32. {fastled-1.2.80 → fastled-1.2.81}/README.md +0 -0
  33. {fastled-1.2.80 → fastled-1.2.81}/RELEASE.md +0 -0
  34. {fastled-1.2.80 → fastled-1.2.81}/TODO.md +0 -0
  35. {fastled-1.2.80 → fastled-1.2.81}/build_exe.py +0 -0
  36. {fastled-1.2.80 → fastled-1.2.81}/build_site.py +0 -0
  37. {fastled-1.2.80 → fastled-1.2.81}/clean +0 -0
  38. {fastled-1.2.80 → fastled-1.2.81}/compiler/CMakeLists.txt +0 -0
  39. {fastled-1.2.80 → fastled-1.2.81}/compiler/__init__.py +0 -0
  40. {fastled-1.2.80 → fastled-1.2.81}/compiler/arduino-pre-process.sh +0 -0
  41. {fastled-1.2.80 → fastled-1.2.81}/compiler/build.sh +0 -0
  42. {fastled-1.2.80 → fastled-1.2.81}/compiler/build_archive.sh +0 -0
  43. {fastled-1.2.80 → fastled-1.2.81}/compiler/build_fast.sh +0 -0
  44. {fastled-1.2.80 → fastled-1.2.81}/compiler/code_sync.py +0 -0
  45. {fastled-1.2.80 → fastled-1.2.81}/compiler/compile_lock.py +0 -0
  46. {fastled-1.2.80 → fastled-1.2.81}/compiler/debug.sh +0 -0
  47. {fastled-1.2.80 → fastled-1.2.81}/compiler/entrypoint.sh +0 -0
  48. {fastled-1.2.80 → fastled-1.2.81}/compiler/extra/100dots.html +0 -0
  49. {fastled-1.2.80 → fastled-1.2.81}/compiler/extra/demo_threejs.html +0 -0
  50. {fastled-1.2.80 → fastled-1.2.81}/compiler/extra/micdemo.html +0 -0
  51. {fastled-1.2.80 → fastled-1.2.81}/compiler/extra/mp3upload.html +0 -0
  52. {fastled-1.2.80 → fastled-1.2.81}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
  53. {fastled-1.2.80 → fastled-1.2.81}/compiler/final_prewarm.sh +0 -0
  54. {fastled-1.2.80 → fastled-1.2.81}/compiler/init_runtime.py +0 -0
  55. {fastled-1.2.80 → fastled-1.2.81}/compiler/install-arduino-cli.sh +0 -0
  56. {fastled-1.2.80 → fastled-1.2.81}/compiler/libcompile/CMakeLists.txt +0 -0
  57. {fastled-1.2.80 → fastled-1.2.81}/compiler/paths.py +0 -0
  58. {fastled-1.2.80 → fastled-1.2.81}/compiler/pre-process.sh +0 -0
  59. {fastled-1.2.80 → fastled-1.2.81}/compiler/prewarm.sh +0 -0
  60. {fastled-1.2.80 → fastled-1.2.81}/compiler/process-ino.py +0 -0
  61. {fastled-1.2.80 → fastled-1.2.81}/compiler/process_extended.py +0 -0
  62. {fastled-1.2.80 → fastled-1.2.81}/compiler/pyproject.toml +0 -0
  63. {fastled-1.2.80 → fastled-1.2.81}/compiler/run.py +0 -0
  64. {fastled-1.2.80 → fastled-1.2.81}/compiler/sketch_hasher.py +0 -0
  65. {fastled-1.2.80 → fastled-1.2.81}/compiler/wasm_compiler_flags.py +0 -0
  66. {fastled-1.2.80 → fastled-1.2.81}/install +0 -0
  67. {fastled-1.2.80 → fastled-1.2.81}/install_linux.sh +0 -0
  68. {fastled-1.2.80 → fastled-1.2.81}/lint +0 -0
  69. {fastled-1.2.80 → fastled-1.2.81}/pyproject.toml +0 -0
  70. {fastled-1.2.80 → fastled-1.2.81}/requirements.testing.txt +0 -0
  71. {fastled-1.2.80 → fastled-1.2.81}/setup.cfg +0 -0
  72. {fastled-1.2.80 → fastled-1.2.81}/setup.py +0 -0
  73. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/app.py +0 -0
  74. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/assets/example.txt +0 -0
  75. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/assets/localhost-key.pem +0 -0
  76. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/assets/localhost.pem +0 -0
  77. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/cli.py +0 -0
  78. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/cli_test.py +0 -0
  79. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/cli_test_interactive.py +0 -0
  80. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/client_server.py +0 -0
  81. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/docker_manager.py +0 -0
  82. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/filewatcher.py +0 -0
  83. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/keyboard.py +0 -0
  84. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/keyz.py +0 -0
  85. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/live_client.py +0 -0
  86. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/open_browser.py +0 -0
  87. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/parse_args.py +0 -0
  88. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/paths.py +0 -0
  89. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/print_filter.py +0 -0
  90. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/project_init.py +0 -0
  91. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/select_sketch_directory.py +0 -0
  92. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/server_fastapi.py +0 -0
  93. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/server_fastapi_cli.py +0 -0
  94. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/server_flask.py +0 -0
  95. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/server_start.py +0 -0
  96. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/settings.py +0 -0
  97. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/site/build.py +0 -0
  98. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/site/examples.py +0 -0
  99. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/sketch.py +0 -0
  100. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/spinner.py +0 -0
  101. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/string_diff.py +0 -0
  102. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/test/can_run_local_docker_tests.py +0 -0
  103. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/test/examples.py +0 -0
  104. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/util.py +0 -0
  105. {fastled-1.2.80 → fastled-1.2.81}/src/fastled/web_compile.py +0 -0
  106. {fastled-1.2.80 → fastled-1.2.81}/src/fastled.egg-info/dependency_links.txt +0 -0
  107. {fastled-1.2.80 → fastled-1.2.81}/src/fastled.egg-info/entry_points.txt +0 -0
  108. {fastled-1.2.80 → fastled-1.2.81}/src/fastled.egg-info/requires.txt +0 -0
  109. {fastled-1.2.80 → fastled-1.2.81}/src/fastled.egg-info/top_level.txt +0 -0
  110. {fastled-1.2.80 → fastled-1.2.81}/test +0 -0
  111. {fastled-1.2.80 → fastled-1.2.81}/tests/integration/test_build_examples.py +0 -0
  112. {fastled-1.2.80 → fastled-1.2.81}/tests/integration/test_examples.py +0 -0
  113. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/html/index.html +0 -0
  114. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_api.py +0 -0
  115. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_bad_ino.py +0 -0
  116. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_cli.py +0 -0
  117. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_compile_server.py +0 -0
  118. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_docker_linux_on_windows.py +0 -0
  119. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_embedded_data.py +0 -0
  120. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_filechanger.py +0 -0
  121. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_http_server.py +0 -0
  122. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_ino/bad/bad.ino +0 -0
  123. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
  124. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
  125. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
  126. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_ino/embedded/wasm.ino +0 -0
  127. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_ino/wasm/wasm.ino +0 -0
  128. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_print_filter.py +0 -0
  129. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_project_init.py +0 -0
  130. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_server_and_client_seperatly.py +0 -0
  131. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_string_diff.py +0 -0
  132. {fastled-1.2.80 → fastled-1.2.81}/tests/unit/test_webcompile.py +0 -0
  133. {fastled-1.2.80 → fastled-1.2.81}/upload_package.sh +0 -0
@@ -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
@@ -86,7 +86,7 @@ def copy_files(src_dir: Path, js_src: Path) -> None:
86
86
  print(f"Copying file: {item}")
87
87
  shutil.copy2(item, js_src / item.name)
88
88
  else:
89
- warnings.warn("No files found in the mapped directory.")
89
+ warnings.warn(f"No files found in the mapped directory: {src_dir.absolute()}")
90
90
 
91
91
 
92
92
  def _banner(msg: str) -> str:
@@ -598,6 +598,40 @@ def project_init_example(
598
598
  )
599
599
 
600
600
 
601
+ @app.get("/sourcefiles/{filepath:path}")
602
+ def source_file(filepath: str) -> FileResponse:
603
+ """Get the source file from the server."""
604
+ print(f"Endpoint accessed: /sourcefiles/{filepath}")
605
+ if ".." in filepath:
606
+ raise HTTPException(status_code=400, detail="Invalid file path.")
607
+ full_path = Path(FASTLED_SRC / filepath)
608
+ if not full_path.exists():
609
+ raise HTTPException(status_code=404, detail="File not found.")
610
+ if not full_path.is_file():
611
+ raise HTTPException(status_code=400, detail="Not a file.")
612
+ if not full_path.is_relative_to(FASTLED_SRC):
613
+ raise HTTPException(status_code=400, detail="Invalid file path.")
614
+
615
+ suffix = full_path.suffix
616
+ if suffix in [".h", ".cpp"]:
617
+ media_type = "text/plain"
618
+ elif suffix == ".html":
619
+ media_type = "text/html"
620
+ elif suffix == ".js":
621
+ media_type = "application/javascript"
622
+ elif suffix == ".css":
623
+ media_type = "text/css"
624
+ else:
625
+ media_type = "application/octet-stream"
626
+
627
+ fr = FileResponse(
628
+ path=full_path,
629
+ media_type=media_type,
630
+ filename=filepath,
631
+ )
632
+ return fr
633
+
634
+
601
635
  @app.get("/static/{file_path:path}")
602
636
  async def static_files(file_path: str) -> Response:
603
637
  """Serve static files."""
@@ -4,6 +4,7 @@ services:
4
4
  build:
5
5
  context: .
6
6
  ports:
7
- - "80:80"
7
+ - "8234:80"
8
8
  environment:
9
9
  - ENVIRONMENT=dev
10
+ image: niteris/fastled-wasm:latest
@@ -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
  ]
@@ -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
 
@@ -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
@@ -113,12 +113,14 @@ tests/unit/test_cli.py
113
113
  tests/unit/test_compile_server.py
114
114
  tests/unit/test_docker_linux_on_windows.py
115
115
  tests/unit/test_embedded_data.py
116
+ tests/unit/test_fastled_source_get.py
116
117
  tests/unit/test_filechanger.py
117
118
  tests/unit/test_http_server.py
118
119
  tests/unit/test_print_filter.py
119
120
  tests/unit/test_project_init.py
120
121
  tests/unit/test_server_and_client_seperatly.py
121
122
  tests/unit/test_string_diff.py
123
+ tests/unit/test_version.py
122
124
  tests/unit/test_webcompile.py
123
125
  tests/unit/html/index.html
124
126
  tests/unit/test_ino/bad/bad.ino
@@ -0,0 +1,32 @@
1
+ import unittest
2
+
3
+ from fastled import Api
4
+
5
+ _DISABLE = False
6
+
7
+
8
+ def _enabled() -> bool:
9
+ """Check if this system can run the tests."""
10
+ from fastled import Test
11
+
12
+ return Test.can_run_local_docker_tests() and not _DISABLE
13
+
14
+
15
+ class WebCompilerTester(unittest.TestCase):
16
+ """Main tester class."""
17
+
18
+ @unittest.skipUnless(
19
+ _enabled(),
20
+ "Skipping test because either this is on non-Linux system on github or embedded data is disabled",
21
+ )
22
+ def test_server_big_data_roundtrip(self) -> None:
23
+ """Tests that embedded data is round tripped correctly."""
24
+ with Api.server() as server:
25
+ resp = server.fetch_source_file("platforms/wasm/js.cpp")
26
+ if isinstance(resp, Exception):
27
+ raise resp
28
+ print("Done")
29
+
30
+
31
+ if __name__ == "__main__":
32
+ unittest.main()
@@ -0,0 +1,27 @@
1
+ """
2
+ Unit test file.
3
+ """
4
+
5
+ import subprocess
6
+ import unittest
7
+
8
+ from fastled import __version__
9
+
10
+ COMMAND = "fastled --version"
11
+
12
+
13
+ class MainTester(unittest.TestCase):
14
+ """Main tester class."""
15
+
16
+ def test_command(self) -> None:
17
+ """Test command line interface (CLI)."""
18
+ stdout = subprocess.check_output(COMMAND, shell=True)
19
+ self.assertEqual(
20
+ stdout.decode("utf-8").strip(),
21
+ "1.2.80",
22
+ f"Version mismatch: {stdout.decode('utf-8').strip()} != {__version__}",
23
+ )
24
+
25
+
26
+ if __name__ == "__main__":
27
+ unittest.main()
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes