From 42518d8d251c10ffd3ee7596a1c916614c46940b Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 13 Jun 2024 16:26:06 -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 in appropriate 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 | 1 - pyproject.toml | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index a64caf4..44610bf 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -420,7 +420,6 @@ tasks: cmds: - | poetry install \ - --no-root \ {{if .POETRY_GROUPS}} --only {{.POETRY_GROUPS}} {{end}} poetry:sync: diff --git a/pyproject.toml b/pyproject.toml index 1773b3d..dd193c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,10 +2,7 @@ line-length = 120 [tool.poetry] -name = "compilesketches" -version = "0.0.0" -description = "" -authors = ["Arduino "] +package-mode = false [tool.poetry.dependencies] python = "3.11.2"