Skip to content

Commit fdda776

Browse files
committed
Install Poetry in dependent tasks
The project's Python package dependencies are managed by the Poetry tool. In addition to the packages used by the action script, project development tools from Python packages are also managed by Poetry. For this reason, Poetry is a dependency of several of the tasks in the taskfile. Previously, there was an undocumented requirement that the contributor have Poetry installed and in their system path. The reason for that approach was that, at the time, the practice was to make a global system installation of Poetry, which might cause problems for some contributors. Since that time, the project has migrated to using pipx to install Poetry. This tool installs Poetry in an virtual environment. Of course, even though this means manual installation of Poetry is no longer the responsibility of the contributor, installation of pipx is. However, the officially recommended mechanism for installing Poetry is now pipx so the contributor would have likely ended up manually installing pipx anyway as a prerequisite for the Poetry installation procedure.
1 parent 1719ade commit fdda776

File tree

5 files changed

+20
-30
lines changed

5 files changed

+20
-30
lines changed

.github/workflows/check-python-task.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ jobs:
7171
with:
7272
python-version-file: pyproject.toml
7373

74-
- name: Install Poetry
75-
run: |
76-
pipx install \
77-
--python "$(which python)" \
78-
poetry
79-
8074
- name: Install Task
8175
uses: arduino/setup-task@v2
8276
with:
@@ -105,12 +99,6 @@ jobs:
10599
with:
106100
python-version-file: pyproject.toml
107101

108-
- name: Install Poetry
109-
run: |
110-
pipx install \
111-
--python "$(which python)" \
112-
poetry
113-
114102
- name: Install Task
115103
uses: arduino/setup-task@v2
116104
with:

.github/workflows/check-yaml-task.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ jobs:
9999
with:
100100
python-version-file: pyproject.toml
101101

102-
- name: Install Poetry
103-
run: |
104-
pipx install \
105-
--python "$(which python)" \
106-
poetry
107-
108102
- name: Install Task
109103
uses: arduino/setup-task@v2
110104
with:

.github/workflows/spell-check-task.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ jobs:
5353
with:
5454
python-version-file: pyproject.toml
5555

56-
- name: Install Poetry
57-
run: |
58-
pipx install \
59-
--python "$(which python)" \
60-
poetry
61-
6256
- name: Install Task
6357
uses: arduino/setup-task@v2
6458
with:

.github/workflows/test-python-poetry-task.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ jobs:
7575
with:
7676
python-version-file: pyproject.toml
7777

78-
- name: Install Poetry
79-
run: |
80-
pipx install \
81-
--python "$(which python)" \
82-
poetry
83-
8478
- name: Install Task
8579
uses: arduino/setup-task@v2
8680
with:

Taskfile.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,30 @@ tasks:
381381
-r "{{.STYLELINTRC_SCHEMA_PATH}}" \
382382
-d "{{.PROJECT_FOLDER}}/{{.INSTANCE_PATH}}"
383383
384+
poetry:install:
385+
desc: Install Poetry
386+
run: once
387+
vars:
388+
PYTHON_PATH:
389+
sh: task utility:normalize-path RAW_PATH="$(which python)"
390+
cmds:
391+
- |
392+
if ! which pipx &>/dev/null; then
393+
echo "pipx not found or not in PATH."
394+
echo "Please install: https://pipx.pypa.io/stable/installation/#installing-pipx"
395+
exit 1
396+
fi
397+
- |
398+
pipx install \
399+
--python "{{.PYTHON_PATH}}" \
400+
poetry
401+
384402
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
385403
poetry:install-deps:
386404
desc: Install dependencies managed by Poetry
387405
run: when_changed
406+
deps:
407+
- task: poetry:install
388408
cmds:
389409
- |
390410
poetry install \

0 commit comments

Comments
 (0)