Skip to content

Commit 133bc94

Browse files
committed
Disable Poetry "package mode"
The project's Python package dependencies are managed using the Poetry tool. By default, Poetry is configured in "package mode", which is intended for use with projects that are a Python package. When Poetry is used in a project like this that is a standalone script, this configuration is inappropriate and has the following effects: * `poetry install` command installs the project as a Python package in addition to the dependencies. * `name`, `version`, `description`, and `authors` fields of the pyproject.toml file are required. Installing the project as a package is completely inappropriate if the project is not a package, and may cause the command to fail with a cryptic error. This can be avoided by passing the `--no-root` flag to the `install` command, but that increases the usage complexity and chance for user error. Although metadata fields under the `tool.poetry` section of the pyproject.toml configuration file are important for a package, in a non-package project there are better ways to provide that information. Since Git tags are used for versioning, the presence of a `version` field is especially harmful since it means duplication of information and extra work for the project maintainer (and likelihood the metadata will not be kept updated). This "package mode" can be disabled via the pyproject.toml configuration file, which causes Poetry to operate purely in the sole capacity in which it is used by this project: to manage dependencies.
1 parent bdd3d8b commit 133bc94

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ tasks:
639639
deps:
640640
- task: poetry:install
641641
cmds:
642-
- poetry install --no-root
642+
- poetry install
643643

644644
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
645645
poetry:update-deps:

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry/pyproject.toml
22

33
[tool.poetry]
4-
name = "arduino-lint"
5-
version = "0.0.0"
6-
description = "arduino-lint"
7-
authors = ["Arduino <[email protected]>"]
4+
package-mode = false
85

96
# The dependencies in this group are installed using pipx; NOT Poetry. The use of the `tool.poetry.group` super-table
107
# is a hack required in order to be able to manage updates of these dependencies via Dependabot.

0 commit comments

Comments
 (0)