Skip to content

Commit 69fd7b0

Browse files
committed
Add pyserial package to action virtual environment
Although Arduino boards platforms traditionally have bundled all dependencies, the ESP32 boards platform expects the pyserial Python package to be preinstalled on Linux systems. Although there is already test coverage and support for user installation of arbitrary Python package dependencies of a platform, the situation is more complex when it comes to this important boards platform. The problem is that there is an established use pattern that should be supported to avoid breaking user workflows. The pattern is the use of a `pip install pyserial` command in the workflow to install the package. That command correctly installs the package in the "user site-packages" folder when the job runs in the `ubuntu-18.04` GitHub Actions runner, as was the case when the use pattern was established. However, pyserial is installed in the Linux package manager "site-packages" folder of the Ubuntu GitHub Actions runner starting from ubuntu-20.04 (most workflows run the arduino/compile-sketches job in the `ubuntu-latest` runner, which is currently `ubuntu-22.04`). This causes the established installation command to terminate without installing the package: ``` Requirement already satisfied: pyserial in /usr/lib/python3/dist-packages (3.5) ``` This did not cause a problem previously because the action was configured to include all system site-packages in the action's Python virtual environment. Because this approach resulted in the uncontrolled introduction of irrelevant packages into the action's Python virtual environment, the action was changed to only include the "user site-packages" in the virtual environment. That is fine if the now-recommended `--ignore-installed` flag is added to the pyserial installation command, but it breaks the established workflows. Although the goal was always to provide a flexible system that would allow the user installation of any arbitrary platform dependency, rather than hardcoding specific dependencies in the action itself, unfortunately I have not been able to find any way to progress in the improvement of the action without breaking the established workflows that compile for ESP32 boards. So as a workaround I am reluctantly adding the pyserial package to the action's virtual environment. This workaround will be reverted before the 2.0.0 release of the action so the pyserial installation command should be retained in workflows and occurrences of the historical `pip install pyserial` (or `pip3 install pyserial`) commands should be updated to the recommended command: ``` pip install --ignore-installed --user pyserial ```
1 parent 26f371d commit 69fd7b0

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ runs:
7373
working-directory: ${{ github.action_path }}
7474
run: |
7575
poetry install \
76-
--only main
76+
--only main,external
7777
7878
- name: Make user-installed Python packages available to platforms
7979
shell: bash

poetry.lock

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ pytest-mock = "3.10.0"
1818
flake8 = "5.0.4"
1919
pep8-naming = "0.13.3"
2020

21+
# Provided only for use by boards platforms
22+
# NOTE: This group is a temporary workaround that will be removed at the 2.0.0 release of the action.
23+
[tool.poetry.group.external]
24+
optional = true
25+
26+
[tool.poetry.group.external.dependencies]
27+
pyserial = "3.5"
28+
2129
[tool.pytest.ini_options]
2230
filterwarnings = [
2331
"error",

0 commit comments

Comments
 (0)