From 133bc949f1c764ebb5531cdbd4138fd05a95c9f3 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 8 Sep 2025 06:33:27 -0700 Subject: [PATCH] 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. --- Taskfile.yml | 2 +- pyproject.toml | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 261ded52..26cbc250 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -639,7 +639,7 @@ tasks: deps: - task: poetry:install cmds: - - poetry install --no-root + - poetry install # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml poetry:update-deps: diff --git a/pyproject.toml b/pyproject.toml index 5b4b7baa..6a018a7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,7 @@ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry/pyproject.toml [tool.poetry] -name = "arduino-lint" -version = "0.0.0" -description = "arduino-lint" -authors = ["Arduino "] +package-mode = false # The dependencies in this group are installed using pipx; NOT Poetry. The use of the `tool.poetry.group` super-table # is a hack required in order to be able to manage updates of these dependencies via Dependabot.