ruff icon indicating copy to clipboard operation
ruff copied to clipboard

fix: target-version fallback with extend

Open denyszhak opened this issue 2 weeks ago • 4 comments

Summary

Closes #21956

Root cause: When a .ruff.toml, ruff.toml config was discovered via ancestor search, Ruff eagerly derived target-version from requires-python in pyproject.toml during config loading. That fallback value then participated in config merging and incorrectly overrode an explicit target-version defined in an extended config.

Fix: Defer the requires-python fallback until after the full extend chain across .ruff.toml / ruff.toml is merged, and apply it only if target-version is still unset.

Impact: Explicit target-version settings in extended configs are now respected, requires-python is only used as a fallback.

Test Plan

Added a new test. I was useful to validate the fix but may be redundant to keep, lmk if you would love me to remove it

denyszhak avatar Dec 14 '25 19:12 denyszhak