Files
Jens b2806e226e fix: use PDM interpreter in generation and formatting scripts (#1277)
## ℹ️ Description
`pdm run generate-artifacts` could fail while creating the default
config when the shell's `python` differed from PDM's selected
interpreter. For example, Python 3.13 on PATH loaded dependencies from
`__pypackages__/3.12`, causing `ModuleNotFoundError:
pydantic_core._pydantic_core`.

Use PDM's interpreter consistently for config generation and Python
post-formatting. This fix is independent of login-entry PR #1276.

## 📋 Changes Summary

- Replace the shell-based config generator with a Python script that
invokes the CLI through `sys.executable`.
- Split `format:py` into a PDM composite so the Python post-formatter
also uses PDM's interpreter.
- Add an integration regression test that regenerates the exact config
snapshot with an unusable Python executable on PATH.
- Preserve supported Python versions, CLI generation behavior, and
generated artifacts. No dependency or user-configuration changes; no
documentation updates needed.

Validation: `pdm run format`, `pdm run lint`, `pdm run test`, `pdm run
generate-artifacts`, and generated-artifact verification passed. The
generator was also verified locally with PDM selecting Python 3.12 while
shell Python resolves to 3.13.

### ⚙️ Type of Change

- [x] 🐞 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (adds new functionality without breaking existing
usage)
- [ ] 💥 Breaking change (changes that might break existing user setups,
scripts, or configurations)

## ✅ Checklist

- [x] I have reviewed my changes to ensure they meet the project's
standards.
- [x] I have tested my changes and ensured that all tests pass (`pdm run
test`).
- [x] I have formatted the code (`pdm run format`).
- [x] I have verified that linting passes (`pdm run lint`).
- [x] I have updated documentation where necessary (no documentation
changes required).

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Improved the configuration generation workflow by using the active
Python environment directly.
* Split Python formatting into separate automatic formatting and
follow-up processing steps for more consistent results.

* **Tests**
* Added integration coverage to verify configuration generation works
reliably even when conflicting Python executables are present on the
system path.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-13 22:26:25 +02:00
..