From 95ca88b7bcd69a5b1da725f18678e65ce8a76f8a Mon Sep 17 00:00:00 2001 From: RobertoRoos <robert.soor@gmail.com> Date: Tue, 23 Jul 2024 13:21:59 +0200 Subject: [PATCH 1/2] Added missing mention of type = "file" reference in [tool.poetry.scripts] (#9510) --- docs/pyproject.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/pyproject.md b/docs/pyproject.md index 3533a7106e6..09387125cbe 100644 --- a/docs/pyproject.md +++ b/docs/pyproject.md @@ -737,7 +737,17 @@ Here, we will have the `my_package_cli` script installed which will execute the When a script is added or updated, run `poetry install` to make them available in the project's virtualenv. {{% /note %}} -### extras +```toml +[tool.poetry.scripts] +my_executable = { reference = "some_binary.exe", type = "file" } +``` + +With this configuration, Poetry will look for the referenced file in the active project and then copy it to the OS installation directory. + +* On Windows the file is placed in the `Scripts/` directory. +* On *nix system the file is placed in the `bin/` directory. + +## `extras` **Deprecated**: Use `project.optional-dependencies` instead. From 12bd0d8b17f7daec669629d31f1eb8e2b0035dba Mon Sep 17 00:00:00 2001 From: RobertoRoos <robert.soor@gmail.com> Date: Thu, 16 Jan 2025 09:40:40 +0100 Subject: [PATCH 2/2] Added notice about type file + Review comments --- docs/pyproject.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/pyproject.md b/docs/pyproject.md index 09387125cbe..340a0518a91 100644 --- a/docs/pyproject.md +++ b/docs/pyproject.md @@ -723,6 +723,7 @@ for more information on other keys and specifying version ranges. ### scripts **Deprecated**: Use `project.scripts` instead. +Use `[tool.poetry.scripts]` only for scripts of type "file", because those are not supported in `[project.scripts]`. This section describes the scripts or executables that will be installed when installing the package @@ -742,12 +743,12 @@ When a script is added or updated, run `poetry install` to make them available i my_executable = { reference = "some_binary.exe", type = "file" } ``` -With this configuration, Poetry will look for the referenced file in the active project and then copy it to the OS installation directory. +This tells Poetry to include the specified file, relative to your project directory, in distribution builds. It will then be copied to the appropriate installation directory for your operating system when your package is installed. * On Windows the file is placed in the `Scripts/` directory. * On *nix system the file is placed in the `bin/` directory. -## `extras` +### `extras` **Deprecated**: Use `project.optional-dependencies` instead.