-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Description
- Poetry version: 1.7.1
- Python version: 3.11.14
- OS version and name: MacOS
- pyproject.toml: Documented example under scripts. Eg:
[tool.poetry]
name = "poetry-example"
version = "0.1.0"
description = ""
authors = []
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
# Documented code
[tool.poetry.scripts]
devtest = { reference = "poetry_example:test.run_tests", extras = ["test"], type = "console" }
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
poetry install generates invalid python for console scrips dependent on extras. If you create a project with the documented toml example and then try to run the script:
% poetry install
Installing dependencies from lock file
Installing the current project: poetry-example (0.1.0)
% source .venv/bin/activate
% devtest
Traceback (most recent call last):
File "/Users/philip/Documents/Development/scratch/venv/bin/devtest", line 6, in <module>
sys.exit(test.run_tests[test]())
TypeError: 'function' object is not subscriptableIt seems the generated script is wrong. Eg:
#!/Users/philip/Documents/Development/scratch/venv/bin/python
import sys
from poetry_example import test
if __name__ == '__main__':
sys.exit(test.run_tests[test]())This should have been:
sys.exit(test.run_tests())Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected