feat: support reading Ruff version from tools.poetry.dependencies (#177)

While Poetry does now support PEP 508, it's still common to use
`tool.poetry.dependencies` - we for example still use it because
Renovate does not support doing lockfile updates for Poetry when using
PEP 508.

This modifies the version finder logic to support determining the Ruff
version from `pyproject.toml` files that use ``tool.poetry.dependencies`
This commit is contained in:
Gareth Jones
2025-07-14 19:58:25 +12:00
committed by GitHub
parent b9e360afba
commit 966d2455d2
8 changed files with 49 additions and 5 deletions
Generated Vendored
+5 -1
View File
@@ -31943,7 +31943,11 @@ function parsePyproject(pyprojectContent) {
function getRuffVersionFromPoetryGroups(pyproject) {
// Special handling for Poetry until it supports PEP 735
// See: <https://github.com/python-poetry/poetry/issues/9751>
const poetryGroups = Object.values(pyproject?.tool?.poetry?.group || {});
const poetry = pyproject?.tool?.poetry || {};
const poetryGroups = Object.values(poetry.group || {});
if (poetry.dependencies) {
poetryGroups.unshift({ dependencies: poetry.dependencies });
}
return poetryGroups
.flatMap((group) => Object.entries(group.dependencies))
.map(([name, spec]) => {