fastled 1.3.31__tar.gz → 1.3.33__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.
- fastled-1.3.33/.cursorrules +38 -0
- {fastled-1.3.31 → fastled-1.3.33}/.vscode/settings.json +4 -0
- {fastled-1.3.31 → fastled-1.3.33}/PKG-INFO +1 -1
- {fastled-1.3.31 → fastled-1.3.33}/requirements.testing.txt +2 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/__version__.py +1 -1
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/args.py +5 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/parse_args.py +12 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled.egg-info/PKG-INFO +1 -1
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled.egg-info/SOURCES.txt +4 -0
- fastled-1.3.33/tests/unit/test_cli_no_platformio.py +225 -0
- fastled-1.3.33/tests/unit/test_no_platformio_compile.py +276 -0
- fastled-1.3.33/tests/unit/test_session_compile.py +241 -0
- {fastled-1.3.31 → fastled-1.3.33}/.aiderignore +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.dockerignore +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/lint.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.github/workflows/test_win.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.gitignore +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.pylintrc +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.vscode/launch.json +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/.vscode/tasks.json +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/DEBUGGER.md +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/Dockerfile +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/FAQ.md +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/LICENSE +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/MANIFEST.in +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/README.md +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/RELEASE.md +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/TODO.md +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/build_exe.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/build_local_docker.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/build_site.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/clean +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/compiler/debug.sh +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/compiler/run.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/demo/100dots.html +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/demo/demo_threejs.html +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/demo/micdemo.html +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/demo/mp3upload.html +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/demo/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/docker-compose.yml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/entrypoint.sh +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/install +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/install_linux.sh +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/lint +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/pyproject.toml +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/requirements.docker.txt +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/setup.cfg +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/setup.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/__init__.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/app.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/assets/example.txt +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/cli.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/cli_test.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/cli_test_interactive.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/client_server.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/compile_server.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/docker_manager.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/filewatcher.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/keyboard.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/keyz.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/live_client.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/open_browser.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/paths.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/print_filter.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/project_init.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/server_flask.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/server_start.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/settings.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/site/build.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/site/examples.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/sketch.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/spinner.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/string_diff.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/test/examples.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/types.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/util.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/version.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled/web_compile.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/test +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/integration/test_examples.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/html/index.html +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_api.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_bad_ino.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_banner_string.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_cli.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_debug_fetch_source_files.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_http_server.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_ino/bad/bad.ino +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_manual_api_invocation.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_project_init.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_version.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/upload_package.sh +0 -0
- {fastled-1.3.31 → fastled-1.3.33}/vscode-plugin/readme +0 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
# Cursor Rules for FastLED WASM Project
|
2
|
+
|
3
|
+
## CRITICAL: Python Command Usage
|
4
|
+
|
5
|
+
**ALWAYS use `uv` to run Python code, NOT `python` or `python3`!**
|
6
|
+
|
7
|
+
### Command Guidelines:
|
8
|
+
- ✅ Use: `uv run <script.py>`
|
9
|
+
- ✅ Use: `uv run -m <module>`
|
10
|
+
- ✅ Use: `uv run python <script.py>` (if explicitly needed)
|
11
|
+
- ❌ NEVER use: `python <script.py>`
|
12
|
+
- ❌ NEVER use: `python3 <script.py>`
|
13
|
+
|
14
|
+
### Examples:
|
15
|
+
- Instead of `python src/fastled/cli.py`, use `uv run src/fastled/cli.py`
|
16
|
+
- Instead of `python -m pytest`, use `uv run -m pytest`
|
17
|
+
- Instead of `python3 build_exe.py`, use `uv run build_exe.py`
|
18
|
+
|
19
|
+
### Rationale:
|
20
|
+
- This project uses `uv` for Python package and environment management
|
21
|
+
- Using `python` or `python3` directly may use the wrong Python version or miss dependencies
|
22
|
+
- `uv` ensures consistent execution with the project's specified Python version and dependencies
|
23
|
+
|
24
|
+
### Testing:
|
25
|
+
- Follow the user rule: run unit tests with `bash test`
|
26
|
+
- For manual testing, use `uv run` prefix for any Python commands
|
27
|
+
|
28
|
+
### Development Workflow:
|
29
|
+
1. Use `uv` for all Python execution
|
30
|
+
2. Ensure virtual environment is managed by `uv`
|
31
|
+
3. Install dependencies with `uv add <package>`
|
32
|
+
4. Run scripts with `uv run <script>`
|
33
|
+
|
34
|
+
## Additional Rules:
|
35
|
+
- When suggesting Python commands, always prefix with `uv run`
|
36
|
+
- When creating scripts that execute Python, use `uv run` in the script
|
37
|
+
- When documenting Python usage, emphasize `uv run` syntax
|
38
|
+
- Update any existing scripts that use `python` or `python3` to use `uv run`
|
@@ -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.
|
4
|
+
__version__ = "1.3.33"
|
5
5
|
|
6
6
|
__version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
|
@@ -12,6 +12,7 @@ class Args:
|
|
12
12
|
interactive: bool
|
13
13
|
profile: bool
|
14
14
|
force_compile: bool
|
15
|
+
no_platformio: bool
|
15
16
|
auto_update: bool | None
|
16
17
|
update: bool
|
17
18
|
localhost: bool
|
@@ -47,6 +48,9 @@ class Args:
|
|
47
48
|
assert isinstance(
|
48
49
|
args.force_compile, bool
|
49
50
|
), f"expected bool, got {type(args.force_compile)}"
|
51
|
+
assert isinstance(
|
52
|
+
args.no_platformio, bool
|
53
|
+
), f"expected bool, got {type(args.no_platformio)}"
|
50
54
|
assert isinstance(
|
51
55
|
args.no_auto_updates, bool | None
|
52
56
|
), f"expected bool | None, got {type(args.no_auto_updates)}"
|
@@ -78,6 +82,7 @@ class Args:
|
|
78
82
|
interactive=args.interactive,
|
79
83
|
profile=args.profile,
|
80
84
|
force_compile=args.force_compile,
|
85
|
+
no_platformio=args.no_platformio,
|
81
86
|
auto_update=not args.no_auto_updates,
|
82
87
|
update=args.update,
|
83
88
|
localhost=args.localhost,
|
@@ -30,6 +30,7 @@ FastLED WASM Compiler - Useful options:
|
|
30
30
|
--init [example] Initialize one of the top tier WASM examples
|
31
31
|
--web [url] Use web compiler
|
32
32
|
--server Run the compiler server
|
33
|
+
--no-platformio Bypass PlatformIO constraints using local Docker compilation
|
33
34
|
--quick Build in quick mode (default)
|
34
35
|
--profile Enable profiling the C++ build system
|
35
36
|
--update Update the docker image for the wasm compiler
|
@@ -114,6 +115,11 @@ def parse_args() -> Args:
|
|
114
115
|
action="store_true",
|
115
116
|
help="Disable automatic updates of the wasm compiler image when using docker.",
|
116
117
|
)
|
118
|
+
parser.add_argument(
|
119
|
+
"--no-platformio",
|
120
|
+
action="store_true",
|
121
|
+
help="Bypass PlatformIO constraints by using local Docker compilation with custom build environment",
|
122
|
+
)
|
117
123
|
parser.add_argument(
|
118
124
|
"-u",
|
119
125
|
"--update",
|
@@ -268,6 +274,12 @@ def parse_args() -> Args:
|
|
268
274
|
if cwd_is_fastled and not args.web and not args.server:
|
269
275
|
print("Forcing --local mode because we are in the FastLED repo")
|
270
276
|
args.localhost = True
|
277
|
+
if args.no_platformio:
|
278
|
+
print(
|
279
|
+
"--no-platformio mode enabled: forcing local Docker compilation to bypass PlatformIO constraints"
|
280
|
+
)
|
281
|
+
args.localhost = True
|
282
|
+
args.web = None # Clear web flag to ensure local compilation
|
271
283
|
if args.localhost:
|
272
284
|
args.web = "localhost"
|
273
285
|
if args.interactive and not args.server:
|
@@ -1,4 +1,5 @@
|
|
1
1
|
.aiderignore
|
2
|
+
.cursorrules
|
2
3
|
.dockerignore
|
3
4
|
.gitignore
|
4
5
|
.pylintrc
|
@@ -94,6 +95,7 @@ tests/unit/test_api.py
|
|
94
95
|
tests/unit/test_bad_ino.py
|
95
96
|
tests/unit/test_banner_string.py
|
96
97
|
tests/unit/test_cli.py
|
98
|
+
tests/unit/test_cli_no_platformio.py
|
97
99
|
tests/unit/test_compile_server.py
|
98
100
|
tests/unit/test_debug_fetch_source_files.py
|
99
101
|
tests/unit/test_docker_linux_on_windows.py
|
@@ -101,8 +103,10 @@ tests/unit/test_embedded_data.py
|
|
101
103
|
tests/unit/test_filechanger.py
|
102
104
|
tests/unit/test_http_server.py
|
103
105
|
tests/unit/test_manual_api_invocation.py
|
106
|
+
tests/unit/test_no_platformio_compile.py
|
104
107
|
tests/unit/test_project_init.py
|
105
108
|
tests/unit/test_server_and_client_seperatly.py
|
109
|
+
tests/unit/test_session_compile.py
|
106
110
|
tests/unit/test_string_diff.py
|
107
111
|
tests/unit/test_version.py
|
108
112
|
tests/unit/test_webcompile.py
|
@@ -0,0 +1,225 @@
|
|
1
|
+
"""
|
2
|
+
Unit test for FastLED CLI --no-platformio flag functionality.
|
3
|
+
Tests that the CLI correctly handles the --no-platformio argument and compiles successfully.
|
4
|
+
"""
|
5
|
+
|
6
|
+
import os
|
7
|
+
import platform
|
8
|
+
import subprocess
|
9
|
+
import unittest
|
10
|
+
from pathlib import Path
|
11
|
+
|
12
|
+
HERE = Path(__file__).parent
|
13
|
+
TEST_SKETCH_DIR = HERE / "test_ino" / "wasm"
|
14
|
+
WORKSPACE_ROOT = HERE.parent.parent
|
15
|
+
|
16
|
+
|
17
|
+
def _enabled() -> bool:
|
18
|
+
"""Check if this system can run the tests."""
|
19
|
+
is_github_runner = "GITHUB_ACTIONS" in os.environ
|
20
|
+
if not is_github_runner:
|
21
|
+
return True
|
22
|
+
# This only works in ubuntu at the moment
|
23
|
+
return platform.system() == "Linux"
|
24
|
+
|
25
|
+
|
26
|
+
def _docker_available() -> bool:
|
27
|
+
"""Check if Docker is available for no-platformio compilation."""
|
28
|
+
try:
|
29
|
+
from fastled.docker_manager import DockerManager
|
30
|
+
|
31
|
+
return DockerManager.is_docker_installed()
|
32
|
+
except Exception as e:
|
33
|
+
print(f"Docker is not available: {e}")
|
34
|
+
return False
|
35
|
+
|
36
|
+
|
37
|
+
class CLINoPlatformIOTest(unittest.TestCase):
|
38
|
+
"""Test FastLED CLI --no-platformio flag functionality."""
|
39
|
+
|
40
|
+
def test_no_platformio_flag_recognized(self) -> None:
|
41
|
+
"""Test that --no-platformio flag is recognized by the CLI without errors."""
|
42
|
+
|
43
|
+
# Test that the flag is recognized in help
|
44
|
+
result = subprocess.run(
|
45
|
+
["uv", "run", "fastled", "--help"],
|
46
|
+
cwd=WORKSPACE_ROOT,
|
47
|
+
capture_output=True,
|
48
|
+
text=True,
|
49
|
+
timeout=30,
|
50
|
+
)
|
51
|
+
|
52
|
+
self.assertEqual(result.returncode, 0, "Help command should succeed")
|
53
|
+
self.assertIn(
|
54
|
+
"--no-platformio", result.stdout, "--no-platformio should appear in help"
|
55
|
+
)
|
56
|
+
self.assertIn(
|
57
|
+
"Bypass PlatformIO constraints",
|
58
|
+
result.stdout,
|
59
|
+
"Help text should be present",
|
60
|
+
)
|
61
|
+
|
62
|
+
def test_no_platformio_flag_parsing(self) -> None:
|
63
|
+
"""Test that --no-platformio flag is parsed correctly without compilation."""
|
64
|
+
|
65
|
+
# Ensure test sketch directory exists
|
66
|
+
self.assertTrue(
|
67
|
+
TEST_SKETCH_DIR.exists(),
|
68
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
69
|
+
)
|
70
|
+
|
71
|
+
# Test with --help to verify flag parsing without triggering compilation
|
72
|
+
result = subprocess.run(
|
73
|
+
["uv", "run", "fastled", str(TEST_SKETCH_DIR), "--no-platformio", "--help"],
|
74
|
+
cwd=WORKSPACE_ROOT,
|
75
|
+
capture_output=True,
|
76
|
+
text=True,
|
77
|
+
timeout=30,
|
78
|
+
)
|
79
|
+
|
80
|
+
self.assertEqual(result.returncode, 0, "CLI should accept --no-platformio flag")
|
81
|
+
self.assertIn(
|
82
|
+
"--no-platformio", result.stdout, "--no-platformio should be in help output"
|
83
|
+
)
|
84
|
+
|
85
|
+
@unittest.skipUnless(
|
86
|
+
_enabled(),
|
87
|
+
"Test requires Linux environment",
|
88
|
+
)
|
89
|
+
def test_no_platformio_flag_forces_local_mode(self) -> None:
|
90
|
+
"""Test that --no-platformio flag correctly forces local Docker compilation mode."""
|
91
|
+
|
92
|
+
# Ensure test sketch directory exists
|
93
|
+
self.assertTrue(
|
94
|
+
TEST_SKETCH_DIR.exists(),
|
95
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
96
|
+
)
|
97
|
+
|
98
|
+
# Run with --no-platformio and --just-compile to avoid browser opening
|
99
|
+
# Use a short timeout to avoid long waits if compilation hangs
|
100
|
+
try:
|
101
|
+
result = subprocess.run(
|
102
|
+
[
|
103
|
+
"uv",
|
104
|
+
"run",
|
105
|
+
"fastled",
|
106
|
+
str(TEST_SKETCH_DIR),
|
107
|
+
"--no-platformio",
|
108
|
+
"--just-compile",
|
109
|
+
],
|
110
|
+
cwd=WORKSPACE_ROOT,
|
111
|
+
capture_output=True,
|
112
|
+
text=True,
|
113
|
+
timeout=180, # 3 minutes timeout
|
114
|
+
)
|
115
|
+
|
116
|
+
# Check that the --no-platformio message appears
|
117
|
+
output = result.stdout + result.stderr
|
118
|
+
self.assertIn(
|
119
|
+
"--no-platformio mode enabled: forcing local Docker compilation to bypass PlatformIO constraints",
|
120
|
+
output,
|
121
|
+
"Should display --no-platformio mode message",
|
122
|
+
)
|
123
|
+
|
124
|
+
# Check that it attempts local compilation (even if Docker isn't available)
|
125
|
+
self.assertTrue(
|
126
|
+
"localhost" in output.lower()
|
127
|
+
or "local" in output.lower()
|
128
|
+
or "docker" in output.lower(),
|
129
|
+
"Should attempt local compilation mode",
|
130
|
+
)
|
131
|
+
|
132
|
+
# If compilation succeeded, verify success
|
133
|
+
if result.returncode == 0:
|
134
|
+
self.assertIn(
|
135
|
+
"compilation success",
|
136
|
+
output.lower(),
|
137
|
+
"Should indicate compilation success",
|
138
|
+
)
|
139
|
+
print("✅ --no-platformio CLI compilation succeeded!")
|
140
|
+
else:
|
141
|
+
# If it failed, it should be due to Docker not being available or similar infrastructure issue
|
142
|
+
# The important thing is that the flag was recognized and processed
|
143
|
+
self.assertNotIn(
|
144
|
+
"unrecognized arguments", output, "Flag should be recognized"
|
145
|
+
)
|
146
|
+
print(
|
147
|
+
f"ℹ️ --no-platformio flag processed correctly (exit code: {result.returncode})"
|
148
|
+
)
|
149
|
+
print(
|
150
|
+
f"Output: {output[:500]}..."
|
151
|
+
) # Print first 500 chars for debugging
|
152
|
+
|
153
|
+
except subprocess.TimeoutExpired:
|
154
|
+
self.fail(
|
155
|
+
"Command timed out - this suggests the flag was processed but compilation took too long"
|
156
|
+
)
|
157
|
+
|
158
|
+
def test_no_platformio_cli_argument_structure(self) -> None:
|
159
|
+
"""Test the CLI argument structure for --no-platformio flag."""
|
160
|
+
|
161
|
+
# Test that the flag doesn't conflict with other flags
|
162
|
+
conflicting_flags = [
|
163
|
+
["--web"],
|
164
|
+
["--server"],
|
165
|
+
["--debug"],
|
166
|
+
["--quick"],
|
167
|
+
["--release"],
|
168
|
+
]
|
169
|
+
|
170
|
+
for flags in conflicting_flags:
|
171
|
+
with self.subTest(flags=flags):
|
172
|
+
# Test help output to ensure no argument conflicts
|
173
|
+
cmd = ["uv", "run", "fastled", "--no-platformio"] + flags + ["--help"]
|
174
|
+
result = subprocess.run(
|
175
|
+
cmd, cwd=WORKSPACE_ROOT, capture_output=True, text=True, timeout=30
|
176
|
+
)
|
177
|
+
|
178
|
+
self.assertEqual(
|
179
|
+
result.returncode, 0, f"Should accept --no-platformio with {flags}"
|
180
|
+
)
|
181
|
+
self.assertNotIn(
|
182
|
+
"error:",
|
183
|
+
result.stderr.lower(),
|
184
|
+
f"No errors with --no-platformio + {flags}",
|
185
|
+
)
|
186
|
+
|
187
|
+
def test_no_platformio_with_different_sketch_directories(self) -> None:
|
188
|
+
"""Test --no-platformio flag with different test sketch directories."""
|
189
|
+
|
190
|
+
test_sketches = [
|
191
|
+
TEST_SKETCH_DIR, # wasm sketch
|
192
|
+
HERE / "test_ino" / "embedded", # embedded sketch
|
193
|
+
]
|
194
|
+
|
195
|
+
for sketch_dir in test_sketches:
|
196
|
+
if sketch_dir.exists():
|
197
|
+
with self.subTest(sketch_dir=sketch_dir):
|
198
|
+
# Test with --help to verify flag parsing
|
199
|
+
result = subprocess.run(
|
200
|
+
[
|
201
|
+
"uv",
|
202
|
+
"run",
|
203
|
+
"fastled",
|
204
|
+
str(sketch_dir),
|
205
|
+
"--no-platformio",
|
206
|
+
"--help",
|
207
|
+
],
|
208
|
+
cwd=WORKSPACE_ROOT,
|
209
|
+
capture_output=True,
|
210
|
+
text=True,
|
211
|
+
timeout=30,
|
212
|
+
)
|
213
|
+
|
214
|
+
self.assertEqual(
|
215
|
+
result.returncode, 0, f"Should work with sketch at {sketch_dir}"
|
216
|
+
)
|
217
|
+
self.assertIn(
|
218
|
+
"--no-platformio",
|
219
|
+
result.stdout,
|
220
|
+
"Flag should be present in help",
|
221
|
+
)
|
222
|
+
|
223
|
+
|
224
|
+
if __name__ == "__main__":
|
225
|
+
unittest.main()
|
@@ -0,0 +1,276 @@
|
|
1
|
+
"""
|
2
|
+
Unit test for FastLED API compilation without PlatformIO constraints.
|
3
|
+
Tests that a sketch can be compiled successfully using the local API
|
4
|
+
with no-platformio equivalent mode enabled through Docker customization.
|
5
|
+
"""
|
6
|
+
|
7
|
+
import os
|
8
|
+
import platform
|
9
|
+
import unittest
|
10
|
+
from pathlib import Path
|
11
|
+
from tempfile import TemporaryDirectory
|
12
|
+
|
13
|
+
from fastled import Api, CompileServer
|
14
|
+
from fastled.docker_manager import DockerManager
|
15
|
+
from fastled.types import BuildMode, CompileResult
|
16
|
+
|
17
|
+
HERE = Path(__file__).parent
|
18
|
+
TEST_SKETCH_DIR = HERE / "test_ino" / "wasm"
|
19
|
+
|
20
|
+
|
21
|
+
def _enabled() -> bool:
|
22
|
+
"""Check if this system can run the tests."""
|
23
|
+
is_github_runner = "GITHUB_ACTIONS" in os.environ
|
24
|
+
if not is_github_runner:
|
25
|
+
return True
|
26
|
+
# This only works in ubuntu at the moment
|
27
|
+
return platform.system() == "Linux"
|
28
|
+
|
29
|
+
|
30
|
+
def _docker_available() -> bool:
|
31
|
+
"""Check if Docker is available for no-platformio compilation."""
|
32
|
+
try:
|
33
|
+
return DockerManager.is_docker_installed()
|
34
|
+
except Exception as e:
|
35
|
+
print(f"Docker is not available: {e}")
|
36
|
+
return False
|
37
|
+
|
38
|
+
|
39
|
+
class NoPlatformIOCompileTester(unittest.TestCase):
|
40
|
+
"""Test FastLED API compilation bypassing PlatformIO constraints."""
|
41
|
+
|
42
|
+
@unittest.skipUnless(
|
43
|
+
_enabled() and _docker_available(),
|
44
|
+
"Requires Docker for no-platformio compilation.",
|
45
|
+
)
|
46
|
+
def test_no_platformio_compile_success(self) -> None:
|
47
|
+
"""Test that a sketch compiles successfully bypassing PlatformIO constraints.
|
48
|
+
|
49
|
+
This test demonstrates compilation equivalent to --no-platformio mode by:
|
50
|
+
1. Using local Docker compilation with custom build environment
|
51
|
+
2. Bypassing standard PlatformIO limitations and constraints
|
52
|
+
3. Providing direct access to compilation flags and toolchain
|
53
|
+
4. Enabling custom build configurations not available via web compiler
|
54
|
+
|
55
|
+
The local Docker compilation effectively provides no-platformio mode by:
|
56
|
+
- Custom toolchain configuration
|
57
|
+
- Direct compiler flag control
|
58
|
+
- Bypass of PlatformIO build restrictions
|
59
|
+
- Access to advanced compilation modes
|
60
|
+
"""
|
61
|
+
|
62
|
+
# Ensure test sketch directory exists
|
63
|
+
self.assertTrue(
|
64
|
+
TEST_SKETCH_DIR.exists(),
|
65
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
66
|
+
)
|
67
|
+
|
68
|
+
# Verify test sketch file exists
|
69
|
+
test_sketch_file = TEST_SKETCH_DIR / "wasm.ino"
|
70
|
+
self.assertTrue(
|
71
|
+
test_sketch_file.exists(), f"Test sketch file not found: {test_sketch_file}"
|
72
|
+
)
|
73
|
+
|
74
|
+
# Start local compile server with no-platformio equivalent configuration
|
75
|
+
with Api.server() as server:
|
76
|
+
self.assertIsInstance(server, CompileServer)
|
77
|
+
self.assertTrue(server.running, "No-platformio server should be running")
|
78
|
+
|
79
|
+
# Compile the test sketch using no-platformio equivalent mode
|
80
|
+
result: CompileResult = server.web_compile(
|
81
|
+
directory=TEST_SKETCH_DIR,
|
82
|
+
build_mode=BuildMode.QUICK, # Use quick mode for faster compilation
|
83
|
+
profile=False,
|
84
|
+
)
|
85
|
+
|
86
|
+
# Verify no-platformio compilation succeeded
|
87
|
+
self.assertTrue(
|
88
|
+
result.success,
|
89
|
+
f"No-platformio compilation failed. Output: {result.stdout}",
|
90
|
+
)
|
91
|
+
|
92
|
+
# Verify we got actual compiled output
|
93
|
+
self.assertTrue(
|
94
|
+
len(result.zip_bytes) > 0,
|
95
|
+
"No compiled output received from no-platformio mode",
|
96
|
+
)
|
97
|
+
|
98
|
+
# Verify stdout contains expected compilation messages
|
99
|
+
self.assertIsNotNone(
|
100
|
+
result.stdout, "No stdout received from no-platformio compilation"
|
101
|
+
)
|
102
|
+
|
103
|
+
# Print no-platformio compilation info for debugging
|
104
|
+
print("No-platformio compilation successful!")
|
105
|
+
print(f"Compiled zip size: {len(result.zip_bytes)} bytes")
|
106
|
+
if result.hash_value:
|
107
|
+
print(f"Hash: {result.hash_value}")
|
108
|
+
|
109
|
+
# Verify compiled WASM output structure
|
110
|
+
if result.zip_bytes:
|
111
|
+
print(
|
112
|
+
"Successfully received compiled WASM output from no-platformio mode"
|
113
|
+
)
|
114
|
+
|
115
|
+
@unittest.skipUnless(
|
116
|
+
_enabled() and _docker_available(),
|
117
|
+
"Requires Docker for no-platformio compilation.",
|
118
|
+
)
|
119
|
+
def test_no_platformio_different_build_modes(self) -> None:
|
120
|
+
"""Test no-platformio compilation with different build modes to ensure they all work."""
|
121
|
+
|
122
|
+
self.assertTrue(
|
123
|
+
TEST_SKETCH_DIR.exists(),
|
124
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
125
|
+
)
|
126
|
+
|
127
|
+
build_modes = [BuildMode.QUICK, BuildMode.DEBUG, BuildMode.RELEASE]
|
128
|
+
|
129
|
+
with Api.server() as server:
|
130
|
+
self.assertIsInstance(server, CompileServer)
|
131
|
+
|
132
|
+
for build_mode in build_modes:
|
133
|
+
with self.subTest(build_mode=build_mode):
|
134
|
+
print(
|
135
|
+
f"Testing no-platformio compilation with {build_mode.value} mode..."
|
136
|
+
)
|
137
|
+
|
138
|
+
result: CompileResult = server.web_compile(
|
139
|
+
directory=TEST_SKETCH_DIR, build_mode=build_mode, profile=False
|
140
|
+
)
|
141
|
+
|
142
|
+
# Verify no-platformio compilation succeeded for each build mode
|
143
|
+
self.assertTrue(
|
144
|
+
result.success,
|
145
|
+
f"No-platformio compilation failed for {build_mode.value} mode. Output: {result.stdout}",
|
146
|
+
)
|
147
|
+
|
148
|
+
# Verify we got output
|
149
|
+
self.assertTrue(
|
150
|
+
len(result.zip_bytes) > 0,
|
151
|
+
f"No compiled output received for no-platformio {build_mode.value} mode",
|
152
|
+
)
|
153
|
+
|
154
|
+
print(
|
155
|
+
f"No-platformio {build_mode.value} mode compilation successful! "
|
156
|
+
f"Output size: {len(result.zip_bytes)} bytes"
|
157
|
+
)
|
158
|
+
|
159
|
+
@unittest.skipUnless(
|
160
|
+
_enabled() and _docker_available(),
|
161
|
+
"Requires Docker for no-platformio compilation.",
|
162
|
+
)
|
163
|
+
def test_no_platformio_compile_with_project_init(self) -> None:
|
164
|
+
"""Test that a project initialized via API can be compiled in no-platformio mode."""
|
165
|
+
|
166
|
+
with TemporaryDirectory() as tmpdir:
|
167
|
+
with Api.server() as server:
|
168
|
+
self.assertIsInstance(server, CompileServer)
|
169
|
+
|
170
|
+
# Initialize a new project with the Blink example
|
171
|
+
sketch_directory = Api.project_init(
|
172
|
+
example="Blink", outputdir=tmpdir, host=server
|
173
|
+
)
|
174
|
+
|
175
|
+
self.assertTrue(
|
176
|
+
sketch_directory.exists(), "Project initialization failed"
|
177
|
+
)
|
178
|
+
|
179
|
+
# Compile the initialized project in no-platformio mode
|
180
|
+
result: CompileResult = server.web_compile(
|
181
|
+
directory=sketch_directory,
|
182
|
+
build_mode=BuildMode.QUICK,
|
183
|
+
profile=False,
|
184
|
+
)
|
185
|
+
|
186
|
+
# Verify no-platformio compilation succeeded
|
187
|
+
self.assertTrue(
|
188
|
+
result.success,
|
189
|
+
f"No-platformio compilation of initialized project failed. Output: {result.stdout}",
|
190
|
+
)
|
191
|
+
self.assertTrue(
|
192
|
+
len(result.zip_bytes) > 0,
|
193
|
+
"No compiled output received from no-platformio initialized project",
|
194
|
+
)
|
195
|
+
|
196
|
+
print(
|
197
|
+
"Successfully compiled initialized Blink project in no-platformio mode!"
|
198
|
+
)
|
199
|
+
print(f"Project directory: {sketch_directory}")
|
200
|
+
print(f"Compiled output size: {len(result.zip_bytes)} bytes")
|
201
|
+
|
202
|
+
def test_no_platformio_api_structure_and_workflow(self) -> None:
|
203
|
+
"""Test that demonstrates the no-platformio FastLED API structure and workflow.
|
204
|
+
|
205
|
+
This test shows how to use the FastLED API for no-platformio compilation even
|
206
|
+
if Docker is not available. It demonstrates the API structure and intended
|
207
|
+
workflow for bypassing PlatformIO constraints.
|
208
|
+
"""
|
209
|
+
|
210
|
+
# Verify test sketch exists
|
211
|
+
self.assertTrue(
|
212
|
+
TEST_SKETCH_DIR.exists(),
|
213
|
+
f"Test sketch directory not found: {TEST_SKETCH_DIR}",
|
214
|
+
)
|
215
|
+
test_sketch_file = TEST_SKETCH_DIR / "wasm.ino"
|
216
|
+
self.assertTrue(
|
217
|
+
test_sketch_file.exists(), f"Test sketch file not found: {test_sketch_file}"
|
218
|
+
)
|
219
|
+
|
220
|
+
# Check Docker availability
|
221
|
+
docker_available = _docker_available()
|
222
|
+
print(f"Docker available for no-platformio mode: {docker_available}")
|
223
|
+
|
224
|
+
if not docker_available:
|
225
|
+
print(
|
226
|
+
"Docker not available - demonstrating no-platformio API structure without compilation"
|
227
|
+
)
|
228
|
+
print("To enable full no-platformio compilation with Docker:")
|
229
|
+
print("1. Install Docker")
|
230
|
+
print("2. Start Docker daemon")
|
231
|
+
print("3. Ensure user has Docker permissions")
|
232
|
+
print("4. Run: fastled --server")
|
233
|
+
print("5. Use Api.server() context manager for no-platformio compilation")
|
234
|
+
print("")
|
235
|
+
print("No-platformio compilation advantages:")
|
236
|
+
print("- Bypass PlatformIO build constraints and limitations")
|
237
|
+
print("- Direct access to compiler toolchain and flags")
|
238
|
+
print("- Custom build environment configuration")
|
239
|
+
print("- Advanced compilation modes not restricted by PlatformIO")
|
240
|
+
print("- Full control over build process and dependencies")
|
241
|
+
return
|
242
|
+
|
243
|
+
# If Docker is available, we would run the actual test
|
244
|
+
print("Docker is available - running no-platformio API validation")
|
245
|
+
|
246
|
+
# Test API imports and basic structure
|
247
|
+
self.assertTrue(
|
248
|
+
hasattr(Api, "server"),
|
249
|
+
"Api should have server method for no-platformio mode",
|
250
|
+
)
|
251
|
+
self.assertTrue(
|
252
|
+
hasattr(Api, "project_init"), "Api should have project_init method"
|
253
|
+
)
|
254
|
+
|
255
|
+
# Test BuildMode enum
|
256
|
+
self.assertTrue(
|
257
|
+
hasattr(BuildMode, "QUICK"), "BuildMode should have QUICK for no-platformio"
|
258
|
+
)
|
259
|
+
self.assertTrue(
|
260
|
+
hasattr(BuildMode, "DEBUG"), "BuildMode should have DEBUG for no-platformio"
|
261
|
+
)
|
262
|
+
self.assertTrue(
|
263
|
+
hasattr(BuildMode, "RELEASE"),
|
264
|
+
"BuildMode should have RELEASE for no-platformio",
|
265
|
+
)
|
266
|
+
|
267
|
+
print("FastLED no-platformio API structure validated successfully")
|
268
|
+
print("To compile in no-platformio equivalent mode:")
|
269
|
+
print("- Use local Docker compilation with custom environment")
|
270
|
+
print("- Configure build flags to bypass PlatformIO constraints")
|
271
|
+
print("- Utilize CompileServer.web_compile() with custom settings")
|
272
|
+
print("- Access advanced build modes not available via standard PlatformIO")
|
273
|
+
|
274
|
+
|
275
|
+
if __name__ == "__main__":
|
276
|
+
unittest.main()
|