Skip to content

fix: reinstall editable dependencies when develop mode changes - #11022

Open
yangfan-yf-yf wants to merge 1 commit into
python-poetry:mainfrom
yangfan-yf-yf:fix/poetry-10666-editable-transition
Open

fix: reinstall editable dependencies when develop mode changes#11022
yangfan-yf-yf wants to merge 1 commit into
python-poetry:mainfrom
yangfan-yf-yf:fix/poetry-10666-editable-transition

Conversation

@yangfan-yf-yf

Copy link
Copy Markdown

Resolves: #7088

Addresses the editable/non-editable sync transition described in #10666.

Summary

When a directory or Git dependency kept the same name, version, and source but
changed between editable and non-editable mode,
Transaction.calculate_operations() treated the installed and resolved
packages as unchanged. As a result, poetry sync did not reinstall the
dependency and left its previous install mode in place.

Treat a change to the package's develop flag as an update condition for the
directory and Git source types that support editable installs. Registry, URL,
and file packages continue to ignore this field. Legacy editable directory
installs discovered through a plain-text .pth file are also marked as
editable, so switching one of those installs to non-editable schedules the
required update.

This does not address the separate transitive dependency metadata problem
described in #10683, where a PEP 621 dependency loses develop = true while
the lock file is built.

Validation

  • Focused editable-state tests: 13 passed
  • Transaction and installed-repository tests: 123 passed
  • Puzzle and installed-repository tests: 394 passed
  • Directory end-to-end installs in both directions verified the module path, .pth
    behavior, and PEP 610 editable metadata
  • Ruff check, Ruff format check, and Mypy passed for the changed Python files
  • git diff --check passed

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code — no user-facing command or
    configuration documentation changes are required.

@yangfan-yf-yf
yangfan-yf-yf marked this pull request as ready for review August 26, 2026 11:06

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the develop-mode comparison is wrong, Poetry may reinstall a directory or Git dependency in the wrong mode, leaving the environment in an incorrect but repairable state after the code is reverted. Reverting stops future incorrect operations, but an affected environment would need the dependency to be reinstalled or synchronized again.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating develop attribute in path dependency forces to recreate the virtualenv to take effect

1 participant