-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poetry run
fails with a keyerror for poetry 2.0.0
#9961
Comments
Thanks for reporting this @bjoernricks. I can confirm this issue. This was introduced in poetry-core with python-poetry/poetry-core#773. @radoering can we simply change https://github.com/python-poetry/poetry-core/pull/773/files#diff-62e4eae7349a9699c84076b1a65f0371d26b188e396dcee122356110960adeffR78 to Edit: Hm, I think we also need to reintroduce this lines: formats = package.get("format")
if formats and not isinstance(formats, list):
formats = [formats] |
This has been long time coming (for example for performance reasons), but was triggered by this poetry update that crashed the CI pipeline: - https://github.com/owasp-sbot/OSBot-Utils/actions/runs/12632720785/job/35198284338 - python-poetry/poetry#9961 - python-poetry/poetry#9957 - python-poetry/poetry-core#803
Hi @bjoernricks, even I faced this issue, for now a quick workaround would be adding format in the packages Also it's mentioned in the poetry documentation here that I think this handling needs to be added where if format is not specified it should default to |
- Resolves #9196 Make all changes necessary to make everything work with Poetry v2.0.0. ## Changes - Removed `--no-update` flag from `poetry lock` command in codebase - Removed extra path arguments from `poetry -C [path] run [command]` occurrences - Regenerated all lock files in hierarchical order - Added workaround for Poetry bug where `packages.[i].format` is now suddenly required Additionally: - Fixed up .dockerignore - Fixes .venv being erroneously copied over from local - Fixes build context bloat (300MB -> 2.5MB) - Fixed warnings about entrypoint script not being installed in docker builds ### Relevant (breaking) changes in v2.0.0 - `--no-update` flag no longer exists for `poetry lock` as it has become default behavior - The `-C` option now actually changes the directory, so any path arguments in `poetry run` commands can/must be removed - Poetry v2.0.0 uses the new v2.1 lock file spec, so all lock files have to be regenerated to avoid false-positive lock file updates and checks on future PRs - **BUG:** when specifying `poetry.tool.packages`, `format` is required now (python-poetry/poetry#9961) Full release notes and change log: https://python-poetry.org/blog/announcing-poetry-2.0.0
- Resolves #9196 Make all changes necessary to make everything work with Poetry v2.0.0. ## Changes - Removed `--no-update` flag from `poetry lock` command in codebase - Removed extra path arguments from `poetry -C [path] run [command]` occurrences - Regenerated all lock files in hierarchical order - Added workaround for Poetry bug where `packages.[i].format` is now suddenly required Additionally: - Fixed up .dockerignore - Fixes .venv being erroneously copied over from local - Fixes build context bloat (300MB -> 2.5MB) - Fixed warnings about entrypoint script not being installed in docker builds ### Relevant (breaking) changes in v2.0.0 - `--no-update` flag no longer exists for `poetry lock` as it has become default behavior - The `-C` option now actually changes the directory, so any path arguments in `poetry run` commands can/must be removed - Poetry v2.0.0 uses the new v2.1 lock file spec, so all lock files have to be regenerated to avoid false-positive lock file updates and checks on future PRs - **BUG:** when specifying `poetry.tool.packages`, `format` is required now - python-poetry/poetry#9961 Full release notes and change log: https://python-poetry.org/blog/announcing-poetry-2.0.0
- Resolves #9196 Make all changes necessary to make everything work with Poetry v2.0.0. ## Changes - Removed `--no-update` flag from `poetry lock` command in codebase - Removed extra path arguments from `poetry -C [path] run [command]` occurrences - Regenerated all lock files in hierarchical order - Added workaround for Poetry bug where `packages.[i].format` is now suddenly required Additionally: - Fixed up .dockerignore - Fixes .venv being erroneously copied over from local - Fixes build context bloat (300MB -> 2.5MB) - Fixed warnings about entrypoint script not being installed in docker builds ### Relevant (breaking) changes in v2.0.0 - `--no-update` flag no longer exists for `poetry lock` as it has become default behavior - The `-C` option now actually changes the directory, so any path arguments in `poetry run` commands can/must be removed - Poetry v2.0.0 uses the new v2.1 lock file spec, so all lock files have to be regenerated to avoid false-positive lock file updates and checks on future PRs - **BUG:** when specifying `poetry.tool.packages`, `format` is required now - python-poetry/poetry#9961 Full release notes and change log: https://python-poetry.org/blog/announcing-poetry-2.0.0
- Resolves #9196 Make all changes necessary to make everything work with Poetry v2.0.0. ## Changes - Removed `--no-update` flag from `poetry lock` command in codebase - Removed extra path arguments from `poetry -C [path] run [command]` occurrences - Regenerated all lock files in hierarchical order - Added workaround for Poetry bug where `packages.[i].format` is now suddenly required Additionally: - Fixed up .dockerignore - Fixes .venv being erroneously copied over from local - Fixes build context bloat (300MB -> 2.5MB) - Fixed warnings about entrypoint script not being installed in docker builds ### Relevant (breaking) changes in v2.0.0 - `--no-update` flag no longer exists for `poetry lock` as it has become default behavior - The `-C` option now actually changes the directory, so any path arguments in `poetry run` commands can/must be removed - Poetry v2.0.0 uses the new v2.1 lock file spec, so all lock files have to be regenerated to avoid false-positive lock file updates and checks on future PRs - **BUG:** when specifying `poetry.tool.packages`, `format` is required now - python-poetry/poetry#9961 Full release notes and change log: https://python-poetry.org/blog/announcing-poetry-2.0.0
Make all changes necessary to make everything work with Poetry v2.0.0. - Resolves #9196 ## Changes - Removed `--no-update` flag from `poetry lock` command in codebase - Removed extra path arguments from `poetry -C [path] run [command]` occurrences - Regenerated all lock files in hierarchical order - Added workaround for Poetry bug where `packages.[i].format` is now suddenly required Additionally: - Fixed up .dockerignore - Fixes .venv being erroneously copied over from local - Fixes build context bloat (300MB -> 2.5MB) - Fixed warnings about entrypoint script not being installed in docker builds ### Relevant (breaking) changes in v2.0.0 - `--no-update` flag no longer exists for `poetry lock` as it has become default behavior - The `-C` option now actually changes the directory, so any path arguments in `poetry run` commands can/must be removed - Poetry v2.0.0 uses the new v2.1 lock file spec, so all lock files have to be regenerated to avoid false-positive lock file updates and checks on future PRs - **BUG:** when specifying `poetry.tool.packages`, `format` is required now - python-poetry/poetry#9961 Full Poetry v2.0.0 release notes and change log: https://python-poetry.org/blog/announcing-poetry-2.0.0
I don't know too much about poetry but I think it would be nice to trying to minimize problems on stable versions. |
I think defaulting to
with 2.0.0 with
|
resolves kernelci#79 Added sdist and wheel as format on pyproject.toml as a temporary fix for poetry format issue bug: python-poetry/poetry#9961 Signed-off-by: Arisu Tachibana <[email protected]>
resolves kernelci#79 Added sdist and wheel as format on pyproject.toml as a temporary fix for poetry format issue bug: python-poetry/poetry#9961 Signed-off-by: Arisu Tachibana <[email protected]>
I suppose for packages include the default is [wheel, sdist]. |
Dear all I have the same issue and was quite perplex when greeted with a red I have now added the appropriate key [tool.poetry]
packages = [
{ include = "package_a" },
{ include = "package_b" },
] should now be: [tool.poetry]
packages = [
{ include = "package_a", format = [
"sdist",
"wheel",
] },
{ include = "package_b", format = [
"sdist",
"wheel",
] },
] Prior to the migration to Poetry 2.0, my package used to build to What is/was the motivation behind the change to only build Best regards |
Faced the same issue here, which only happens if my project |
resolves kernelci#79 Added sdist and wheel as format on pyproject.toml as a temporary fix for poetry format issue bug: python-poetry/poetry#9961 Signed-off-by: Arisu Tachibana <[email protected]>
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
With the latest poetry release 2.0.0 calling a script via
poetry run
always fails with a KeyError.Steps to reproduce.
pyproject.toml
into that new directorysomeproject/__init__.py
file in that temporary directory with the following contentpoetry run sometool
Workarounds
None
Poetry Installation Method
pipx
Operating System
Ubuntu 24.04
Poetry Version
Poetry (version 2.0.0)
Poetry Configuration
Poetry Runtime Logs
The text was updated successfully, but these errors were encountered: