Python 3.12.x is incompatible with the version of the node-gyp dependency used by this project (9.4.0). Previously, the
workflow used whichever version of Python was pre-installed on the GitHub Actions runner machine. The Python version was
recently updated from 3.11.5 to 3.12.0 in the macOS runner, which caused the workflow to start failing:
```
> electron-rebuild
- Searching dependency tree
Traceback (most recent call last):
File "/Users/runner/work/lab-micropython-editor/lab-micropython-editor/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
import gyp # noqa: E402
^^^^^^^^^^
File "/Users/runner/work/lab-micropython-editor/lab-micropython-editor/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
import gyp.input
File "/Users/runner/work/lab-micropython-editor/lab-micropython-editor/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'
✖ Rebuild Failed
An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/Users/runner/work/lab-micropython-editor/lab-micropython-editor/node_modules/@serialport/bindings-cpp'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
Error: `gyp` failed with exit code: 1
```
The incompatibility has been fixed in node-gyp and released in version 10.0.0, but it is not trivial to update node-gyp
because it is a transitive dependency of the direct electron-rebuild dependency, which specifies node-gyp@^9.0.0.
For this reason, the chosen solution is to configure the "GitHub Actions" workflow to use the compatible Python 3.11.x.
At such time as a new version of electron-rebuild is released that indicates compatibility with node-gyp@^10.0.0 and the
project's dependencies are updated, pinning to Python 3.11.x specifically will no longer be needed. However, it will
likely be best practices to leave this actions/setup-python step in the workflow even after that since it allows the
version of Python used for the build to be controlled by the project maintainers, and for consistency across all the
runner machines (at this time, the preinstalled version on the Linux machine is 3.10.12 and the Windows machine 3.7.9).