Skip to content

Commit 2465131

Browse files
Fix PDM settings ignoring PDM's config layers (#609, #566) (#611)
* Start fix for #609, #566 Assisted-by: Claude Code:claude-opus-5-5 * Read PDM settings through PDM's config layers Agent mode decided whether a PDM project uses PEP 582 (__pypackages__) from the project's pdm.toml alone, and only when use_venv was a TOML bool. PDM 2.27+ writes `use_venv = "false"`, and plain `pdm config python.use_venv false` writes the user config, so socket-patch patched an activated or stray venv instead of the copy `pdm run` imports (#609). Global mode likewise skipped PDM's site config (/etc/xdg/pdm/config.toml and the macOS/Windows equivalents), so a global project relocated there was never crawled and `get -g` could patch a different copy (#566). Settings now resolve in PDM's order: environment, project config, user config ($PDM_CONFIG_FILE or the per-user file), then the site config, with string values parsed like PDM's ensure_boolean. Assisted-by: Claude Code:claude-opus-5-5 * Read one PDM user config, skip empty XDG dirs PDM reads a single user config file: the most specific per-user config dir platformdirs picks. A use_venv missing from $XDG_CONFIG_HOME/pdm/config.toml no longer falls through to ~/.config/pdm, which PDM never reads in that setup. A leading empty or relative $XDG_CONFIG_DIRS entry (e.g. from "$XDG_CONFIG_DIRS:/other" with the variable unset) no longer drops the site config layer. The first absolute entry is used, falling back to /etc/xdg. Assisted-by: Claude Code:claude-opus-5-5 * Match PDM project precedence and macOS site config Honor XDG_CONFIG_DIRS for macOS site defaults and preserve native root/whitespace handling. Overlay legacy project settings before modern pdm.toml, while retaining environment priority and missing-key fallback. Enable site-layer tests on macOS and cover both legacy/string directions. Validation: 68 Python crawler tests passed; native PDM 2.29.2 controls with platformdirs 4.9.6 and 4.12.2. The legacy regression also passes on main and fails with the original PR lookup. * Resolve implicit PDM site config with its macOS runtime --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0c1e07b commit 2465131

3 files changed

Lines changed: 991 additions & 29 deletions

File tree

0 commit comments

Comments
 (0)