Skip to content

Give Python virtual environment access to system site-packages directory #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2020
Merged

Give Python virtual environment access to system site-packages directory #15

merged 2 commits into from
Nov 9, 2020

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Nov 9, 2020

Use the venv --system-site-packages flag when creating the Python virtual environment the action's script runs in to allow users to install Python package dependencies of their sketch's boards platform dependencies.

The immediate need for this is that the ESP32 boards platform has a dependency on the pyserial Python package. This results in the compilation for boards of that platform failing:

  Traceback (most recent call last):
    File "/home/runner/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
      import serial
  ModuleNotFoundError: No module named 'serial'
  Error during build: exit status 1

Prior to this change, this error would occur even if the user installed the pyserial package in a previous workflow step.

The alternative would be to always install this specific package in the setup script, but allowing the user to install arbitrary Python package dependencies makes the action more flexible:

- run: pip3 install pyserial
- uses: arduino/compile-sketches@main
  with:
    platforms: |
      - name: esp32:esp32
        source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
    fqbn: esp32:esp32:esp32

The cons:

  • Increased complexity of workflows compiling for ESP32 platform boards due to the need for the package installation step.
  • Risk of the runner's default packages interfering with the script.

Supercedes arduino/actions#85

Use the` venv --system-site-packages` flag when creating the Python virtual environment the action's script runs in to allow users to install Python package dependencies of their sketch's boards platform dependencies.

The immediate need for this is that the ESP32 boards platform has a dependency on the `pyserial` Python package. The alternative would be to always install this specific package in the setup script, but allowing the user to install arbitrary Python package dependencies makes the action more flexible.

The cons:
- Increased complexity of workflows compiling for ESP32 platform boards.
- Risk of the runner's default packages interfering with the script.
@codecov-io
Copy link

Codecov Report

Merging #15 (22571ca) into main (f31b227) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #15   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines         1561      1561           
=========================================
  Hits          1561      1561           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f31b227...22571ca. Read the comment docs.

Copy link

@platisd platisd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tried it out and it builds as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants