Skip to content

Commit 670c810

Browse files
authored
Merge pull request #294 from per1234/dependabot-poetry
Manage versioning of Poetry tool dependency
2 parents 1719ade + e5f98c3 commit 670c810

7 files changed

+47
-31
lines changed

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

-12
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

-6
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

-6
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

-6
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

+32
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,42 @@ 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+
if ! which yq &>/dev/null; then
399+
echo "yq not found or not in PATH."
400+
echo "Please install: https://github.com/mikefarah/yq/#install"
401+
exit 1
402+
fi
403+
- |
404+
pipx install \
405+
--python "{{.PYTHON_PATH}}" \
406+
"poetry==$( \
407+
yq \
408+
--input-format toml \
409+
--output-format yaml \
410+
'.tool.poetry.group.pipx.dependencies.poetry' \
411+
< pyproject.toml
412+
)"
413+
384414
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
385415
poetry:install-deps:
386416
desc: Install dependencies managed by Poetry
387417
run: when_changed
418+
deps:
419+
- task: poetry:install
388420
cmds:
389421
- |
390422
poetry install \

action.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ runs:
8787
# Install Poetry.
8888
pipx install \
8989
--python "$(which python)" \
90-
poetry==1.4.0
90+
"poetry==$( \
91+
yq \
92+
--input-format toml \
93+
--output-format yaml \
94+
'.tool.poetry.group.pipx.dependencies.poetry' \
95+
< pyproject.toml
96+
)"
9197
9298
# Install Python dependencies.
9399
poetry install \

pyproject.toml

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ optional = true
3232
[tool.poetry.group.external.dependencies]
3333
pyserial = "3.5"
3434

35+
# The dependencies in this group are installed using pipx; NOT Poetry. The use of a `poetry` section is a hack required
36+
# in order to be able to manage updates of these dependencies via Dependabot, as used for all other dependencies.
37+
[tool.poetry.group.pipx]
38+
optional = true
39+
40+
[tool.poetry.group.pipx.dependencies]
41+
poetry = "1.4.0"
42+
3543
[build-system]
3644
requires = ["poetry-core"]
3745
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)