Skip to content

Commit 5b15c7e

Browse files
authored
Merge pull request #130 from per1234/dependabot-poetry
Manage versioning of Poetry tool dependency
2 parents ab6286b + 5da9ace commit 5b15c7e

7 files changed

+1440
-31
lines changed

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

-6
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ jobs:
6565
with:
6666
python-version: ${{ env.PYTHON_VERSION }}
6767

68-
- name: Install Poetry
69-
run: pip install poetry
70-
7168
- name: Install Task
7269
uses: arduino/setup-task@v2
7370
with:
@@ -93,9 +90,6 @@ jobs:
9390
with:
9491
python-version: ${{ env.PYTHON_VERSION }}
9592

96-
- name: Install Poetry
97-
run: pip install poetry
98-
9993
- name: Install Task
10094
uses: arduino/setup-task@v2
10195
with:

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

-9
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ jobs:
7979
with:
8080
python-version: ${{ env.PYTHON_VERSION }}
8181

82-
- name: Install Poetry
83-
run: pip install poetry
84-
8582
- name: Install Task
8683
uses: arduino/setup-task@v2
8784
with:
@@ -110,9 +107,6 @@ jobs:
110107
with:
111108
python-version: ${{ env.PYTHON_VERSION }}
112109

113-
- name: Install Poetry
114-
run: pip install poetry
115-
116110
- name: Install Task
117111
uses: arduino/setup-task@v2
118112
with:
@@ -141,9 +135,6 @@ jobs:
141135
with:
142136
python-version: ${{ env.PYTHON_VERSION }}
143137

144-
- name: Install Poetry
145-
run: pip install poetry
146-
147138
- name: Install Task
148139
uses: arduino/setup-task@v2
149140
with:

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

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ jobs:
5757
with:
5858
python-version: ${{ env.PYTHON_VERSION }}
5959

60-
- name: Install Poetry
61-
run: pip install poetry
62-
6360
- name: Install Task
6461
uses: arduino/setup-task@v2
6562
with:

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

-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ jobs:
8181
with:
8282
python-version: ${{ env.PYTHON_VERSION }}
8383

84-
- name: Install Poetry
85-
run: pip install poetry
86-
8784
- name: Install Task
8885
uses: arduino/setup-task@v2
8986
with:

Taskfile.yml

+37
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,49 @@ tasks:
208208
-r "{{.STYLELINTRC_SCHEMA_PATH}}" \
209209
-d "{{.PROJECT_FOLDER}}/{{.INSTANCE_PATH}}"
210210
211+
poetry:install:
212+
desc: Install Poetry
213+
run: once
214+
cmds:
215+
- |
216+
if ! which pipx &>/dev/null; then
217+
echo "pipx not found or not in PATH."
218+
echo "Please install: https://pipx.pypa.io/stable/installation/#installing-pipx"
219+
exit 1
220+
fi
221+
- |
222+
if ! which yq &>/dev/null; then
223+
echo "yq not found or not in PATH."
224+
echo "Please install: https://github.com/mikefarah/yq/#install"
225+
exit 1
226+
fi
227+
- |
228+
export PIPX_DEFAULT_PYTHON="$( \
229+
task utility:normalize-path \
230+
RAW_PATH="$(which python)" \
231+
)"
232+
pipx install \
233+
--force \
234+
"poetry==$( \
235+
yq \
236+
--input-format toml \
237+
--output-format yaml \
238+
'.tool.poetry.group.pipx.dependencies.poetry' \
239+
< pyproject.toml
240+
)"
241+
211242
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
212243
poetry:install-deps:
213244
desc: Install dependencies managed by Poetry
245+
deps:
246+
- task: poetry:install
214247
cmds:
215248
- poetry install --no-root
216249

217250
poetry:sync:
218251
desc: Sync poetry.lock
252+
deps:
253+
- task: poetry:install
219254
cmds:
220255
- |
221256
poetry \
@@ -224,6 +259,8 @@ tasks:
224259
225260
poetry:validate:
226261
desc: Validate pyproject.toml
262+
deps:
263+
- task: poetry:install
227264
cmds:
228265
- |
229266
poetry \

poetry.lock

+1,395-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ pytest = "7.4.3"
2020
pytest-mock = "3.12.0"
2121
mypy = "1.7.1"
2222

23+
# The dependencies in this group are installed using pipx; NOT Poetry. The use of a `poetry` section is a hack required
24+
# in order to be able to manage updates of these dependencies via Dependabot, as used for all other dependencies.
25+
[tool.poetry.group.pipx]
26+
optional = true
27+
28+
[tool.poetry.group.pipx.dependencies]
29+
poetry = "2.1.1"
30+
2331
[build-system]
2432
requires = ["poetry-core"]
2533
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)