-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
python-poetry/poetry-core
#805Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/confirmedIssue is reproduced and confirmedIssue is reproduced and confirmed
Description
Description
With the latest poetry release 2.0.0 calling a script via poetry run
always fails with a KeyError.
KeyError
'format'
at ~/.local/share/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/core/masonry/utils/module.py:79 in __init__
75│ self._package_includes.append(
76│ PackageInclude(
77│ self._path,
78│ package["include"],
→ 79│ formats=package["format"],
80│ source=package.get("from"),
81│ target=package.get("to"),
82│ )
83│ )
Steps to reproduce.
- Install poetry via pipx
- Create a temporary directory
- Change into the temporary directory
- Copy the following
pyproject.toml
into that new directory
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "tmp"
version = "0.1.0"
description = ""
authors = ["Foo Bar <[email protected]>"]
readme = "README.md"
packages = [{ include = "somepackage" }]
[tool.poetry.scripts]
sometool = "somepackage:main"
- Create a
someproject/__init__.py
file in that temporary directory with the following content
def main():
print("Hello from somepackage")
- Call
poetry run sometool
Workarounds
None
Poetry Installation Method
pipx
Operating System
Ubuntu 24.04
Poetry Version
Poetry (version 2.0.0)
Poetry Configuration
cache-dir = "/home/bricks/.cache/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /home/bricks/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
### Python Sysconfig
_No response_
### Example pyproject.toml
```TOML
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "tmp"
version = "0.1.0"
description = ""
authors = ["Foo Bar <[email protected]>"]
readme = "README.md"
packages = [{ include = "somepackage" }]
[tool.poetry.scripts]
sometool = "somepackage:main"
Poetry Runtime Logs
poetry run -vvv sometool
KeyError
'format'
at ~/.local/share/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/core/masonry/utils/module.py:79 in __init__
75│ self._package_includes.append(
76│ PackageInclude(
77│ self._path,
78│ package["include"],
→ 79│ formats=package["format"],
80│ source=package.get("from"),
81│ target=package.get("to"),
82│ )
Pwuts, tari, andrewwong1221, jorenham, GLeurquin and 8 morey0urself, wainejr, mkredzel, n-thumann, mbrinkhoff and 1 more
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/confirmedIssue is reproduced and confirmedIssue is reproduced and confirmed