Skip to content

Commit 6c8ee09

Browse files
committed
Only install Python package dependencies from relevant group
The "Poetry" tool is used to manage the project's Python package dependencies. Dependencies might be classified into distinct categories. The most basic classification would be: - Application dependencies: used by the project's applications - Development dependencies: tools used in the development and maintenance of the project, but not by the application By default, Poetry installs all non-optional dependencies. This can be inefficient in a case where a specific operation is being performed, since a given operation might only require the dependencies from one category and so the installation of dependencies from the other is pointless for that operation. For this reason, Poetry allows the user to organize dependencies into arbitrary "groups", and to specify which groups should be installed. The Python package installation task is hereby updated to allow dependency groups to be specified, and the calls to that task updated to specify the groups they require.
1 parent 03636cb commit 6c8ee09

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Taskfile.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ tasks:
122122
desc: Check for commonly misspelled words
123123
deps:
124124
- task: poetry:install-deps
125+
vars:
126+
POETRY_GROUPS: dev
125127
cmds:
126128
- |
127129
poetry run \
@@ -132,6 +134,8 @@ tasks:
132134
desc: Correct commonly misspelled words where possible
133135
deps:
134136
- task: poetry:install-deps
137+
vars:
138+
POETRY_GROUPS: dev
135139
cmds:
136140
- |
137141
poetry run \
@@ -380,11 +384,17 @@ tasks:
380384
381385
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
382386
poetry:install-deps:
383-
desc: Install dependencies managed by Poetry
387+
desc: |
388+
Install dependencies managed by Poetry.
389+
Environment variable parameters:
390+
POETRY_GROUPS: Poetry dependency groups to install (default: install all dependencies).
384391
deps:
385392
- task: poetry:install
386393
cmds:
387-
- poetry install --no-root
394+
- |
395+
poetry install \
396+
--no-root \
397+
{{if .POETRY_GROUPS}} --only {{.POETRY_GROUPS}} {{end}}
388398
389399
# Make a temporary file named according to the passed TEMPLATE variable and print the path passed to stdout
390400
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/windows-task/Taskfile.yml
@@ -426,6 +436,8 @@ tasks:
426436
desc: Check for problems with YAML files
427437
deps:
428438
- task: poetry:install-deps
439+
vars:
440+
POETRY_GROUPS: dev
429441
cmds:
430442
- |
431443
poetry run \

0 commit comments

Comments
 (0)