Fix duplicate local dependencies in pip install command#255
Open
basnijholt wants to merge 3 commits intomainfrom
Open
Fix duplicate local dependencies in pip install command#255basnijholt wants to merge 3 commits intomainfrom
basnijholt wants to merge 3 commits intomainfrom
Conversation
This test demonstrates a bug where local dependencies that are referenced by multiple projects appear multiple times in the pip install command. The test currently fails, showing that the same dependency is added 3 times instead of once. Related to CI issue: https://github.com/ionq/system_performance/actions/runs/17304244901/job/49123013838?pr=925
When multiple projects reference the same local dependency, the deduplication logic was not properly preventing duplicates. The installable_set was created once but not updated as new dependencies were added, causing the same dependency to appear multiple times. This fix updates the installable_set each time a new dependency is added, ensuring proper deduplication. Fixes the issue where packages like third_party/cypress were being repeated 9 times in the pip install command in CI.
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #255 +/- ##
=======================================
Coverage 97.12% 97.13%
=======================================
Files 10 10
Lines 1497 1502 +5
=======================================
+ Hits 1454 1459 +5
Misses 43 43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
When multiple projects reference the same local dependency through
local_dependencies:in theirrequirements.yaml, the dependency was being added multiple times to the pip install command. This was observed in CI wherethird_party/cypressappeared 9 times in a single pip install command.Root Cause
The deduplication logic in
_install_commandfunction was flawed:installable_setfrom existing packageslocal_dependencies.values()Solution
Updated the deduplication logic to maintain the
installable_setas dependencies are added:Test Plan
test_no_duplicate_local_dependencies_in_install_commandthat reproduces the issueRelated Issues
📚 Documentation preview 📚: https://unidep--255.org.readthedocs.build/en/255/