Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use pyproject.toml as Python version source
All execution, development and validation for the project is performed using a specific version of Python.

Poetry is used for Python package dependencies management. Poetry installs dependencies into a virtual environment. For
this reason, the Poetry configuration includes a Python version number, which must match the correct version of Python
for the project. This configuration is stored in the `pyproject.toml` file.

Python is installed in the GitHub Actions runner environments using the actions/setup-python action, which also must be
configured to install the correct version of Python. Previously a the version number for use by the actions/setup-python
action was defined in the `.python-version` file. This allowed the Python version for use by the
arduino/compile-sketches action's execution and all the workflows that make up its infrastructure to be configured from
a single source. However, Poetry does not support the `.python-version` file so we were stuck with two copies of the
Python version information, which must be kept in sync.

Fortunately, support for using `pyproject.toml` as the version file for the actions/setup-python action was recently
added. This means it is now possible for all components of the project infrastructure to get the Python version from a
single source.
  • Loading branch information
per1234 committed Jun 13, 2024
commit b976f9469cbce850a1ec457776e349fc06df87e1
6 changes: 2 additions & 4 deletions .github/workflows/check-python-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- "**/poetry.lock"
- "**/pyproject.toml"
- "**/setup.cfg"
- ".python-version"
- "Taskfile.ya?ml"
- "**/tox.ini"
- "**.py"
Expand All @@ -22,7 +21,6 @@ on:
- "**/poetry.lock"
- "**/pyproject.toml"
- "**/setup.cfg"
- ".python-version"
- "Taskfile.ya?ml"
- "**/tox.ini"
- "**.py"
Expand Down Expand Up @@ -71,7 +69,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
python-version-file: pyproject.toml

- name: Install Poetry
run: |
Expand Down Expand Up @@ -105,7 +103,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
python-version-file: pyproject.toml

- name: Install Poetry
run: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/check-yaml-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
create:
push:
paths:
- ".python-version"
- ".yamllint*"
- "poetry.lock"
- "pyproject.toml"
Expand All @@ -23,7 +22,6 @@ on:
- "**.syntax"
pull_request:
paths:
- ".python-version"
- ".yamllint*"
- "poetry.lock"
- "pyproject.toml"
Expand Down Expand Up @@ -99,7 +97,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
python-version-file: pyproject.toml

- name: Install Poetry
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spell-check-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
python-version-file: pyproject.toml

- name: Install Poetry
run: |
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
paths:
- ".github/workflows/test-integration.yml"
- ".github/workflows/testdata/**"
- ".python-version"
- "poetry.lock"
- "pyproject.toml"
- "action.yml"
Expand All @@ -17,7 +16,6 @@ on:
paths:
- ".github/workflows/test-integration.yml"
- ".github/workflows/testdata/**"
- ".python-version"
- "poetry.lock"
- "pyproject.toml"
- "action.yml"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-python-poetry-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- "dev/.?codecov.ya?ml"
- ".?codecov.ya?ml"
- "Taskfile.ya?ml"
- ".python-version"
- "poetry.lock"
- "pyproject.toml"
- "compilesketches/tests/**"
Expand All @@ -24,7 +23,6 @@ on:
- "dev/.?codecov.ya?ml"
- ".?codecov.ya?ml"
- "Taskfile.ya?ml"
- ".python-version"
- "poetry.lock"
- "pyproject.toml"
- "compilesketches/tests/**"
Expand Down Expand Up @@ -75,7 +73,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
python-version-file: pyproject.toml

- name: Install Poetry
run: |
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ runs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: ${{ github.action_path }}/.python-version
python-version-file: ${{ github.action_path }}/pyproject.toml

- name: Action setup
shell: bash
Expand Down