Skip to content

Commit

Permalink
Support [tool.poetry] being used with PEP-621
Browse files Browse the repository at this point in the history
`[tool.poetry]` section can co-exist with a PEP-621 styled project metadata to provide extra information. In `_pin_dependency` missing `name` and `version` keys inside a `poetry_config` raises `KeyError`s which aren't caught and leads to a fatal error.
  • Loading branch information
stevapple authored Mar 3, 2025
1 parent 3aec18e commit d53b24d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion poetry_monoranger_plugin/path_dep_pinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _pin_dependency(self, dependency: DirectoryDependency):
try:
name = cast(str, dep_pyproject.poetry_config["name"])
version = cast(str, dep_pyproject.poetry_config["version"])
except PyProjectError:
except (PyProjectError, KeyError):
# Fallback to the project section since Poetry V2 also supports PEP 621 pyproject.toml files
name = cast(str, dep_pyproject.data["project"]["name"])
version = cast(str, dep_pyproject.data["project"]["version"])
Expand Down

0 comments on commit d53b24d

Please sign in to comment.