Fix repeated updates caused by stale VCS source directories - #11058
Fix repeated updates caused by stale VCS source directories#11058aprylewu wants to merge 2 commits into
Conversation
A checkout left under the environment's src directory does not establish that the installed distribution still comes from Git. After switching to an index release, this fallback misclassifies its source and schedules an update on every install. Require the existing .pth, egg-info or PEP 610 metadata paths instead, without removing the checkout. Fixes python-poetry#7089 Signed-off-by: Mingyang Wu <129849514+aprylewu@users.noreply.github.com> Assisted-by: OpenAI Codex
|
This reverses #3867 - presumably it breaks whatever that fixed |
Check same-version Git revision changes through installed package discovery and transaction planning. Cover PEP 610 installs and legacy environments without .pth or direct_url.json, including the one-time reinstall needed to recover origin metadata. Signed-off-by: Mingyang Wu <129849514+aprylewu@users.noreply.github.com> Assisted-by: OpenAI Codex
|
Yes, #3867 introduced exactly this fallback; I should have checked that history before submitting. I checked #2921 and added four cases in 7e79226 covering same-version Git revision changes, with and without There is a compatibility change: a metadata-less legacy install is no longer inferred to be Git from the checkout directory. A Git requirement triggers one reinstall, after which the executor writes PEP 610 metadata and subsequent installs skip it. I verified that unchanged-commit migration too and documented this one-time reinstall in the PR description. Existing |
Pull Request Check List
Resolves: #7089
A checkout left in
<venv>/src/<name>after switching from a Git dependency to an index release is currently enough for Poetry to classify the installed release as a Git package. This makes subsequent installs repeatedly schedule an update even when the installed version is already correct.Stop treating the presence of that source directory alone as installation metadata. Keep the existing
.pth, source-local egg-info, and PEP 610 detection paths. The checkout is left intact.The new regression creates actual temporary dist-info metadata and a source directory, with and without a
.pthlink. On the original code, the unlinked case fails because it is incorrectly classified as Git; the linked case passes.Validation on macOS / Python 3.13.5:
pytest -n 0 tests/repositories/test_installed_repository.py: 29 passed, including existing.pth, legacy egg-info, and PEP 610 cases.pytest -n 0 tests/puzzle/test_transaction.py: 89 passed..pth, legacy egg-info, and PEP 610 sources retain their original metadata.mypy: no issues in 380 source files.pre-commit run --files src/poetry/repositories/installed_repository.py tests/repositories/test_installed_repository.py: all applicable checks passed.The unit tests use temporary metadata and existing Git-info fixtures. I also ran an offline CLI reproduction of #2921 using a local Git dependency at a fixed package version: advancing the branch updates the imported module, lock file, and PEP 610 commit ID, both with normal metadata and after removing the origin metadata. Subsequent
poetry installruns skip the dependency. Poetry and poetry-core were tested from current main; the entire project test suite was not run.Compatibility with #3867: that PR introduced the directory fallback removed here. Existing installs without
.pthordirect_url.jsonlose the inferred Git classification. A Git requirement then schedules a reinstall even at the same version; the executor writes origin metadata so later installs can skip it. This can cause a one-time reinstall for such legacy environments. Four new cases cover unchanged/changed Git revisions with and without origin metadata;.pth, source-local egg-info, and PEP 610 discovery remain supported.Prepared with OpenAI Codex assistance and independently reviewed by another Codex agent.