Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manager/pip-compile): Support -r dependencies between files #28052

Merged
merged 10 commits into from Mar 29, 2024

Conversation

mbudnek
Copy link
Contributor

@mbudnek mbudnek commented Mar 20, 2024

Changes

Pip-compile supports including other requirements files via the -r flag. The pip_requirements manager already extracts those flags, but this adds logic to the pip-compile manager to make sure dependent files' lock files get updated when a package is updated in a file that is included via a -r directive.

Note that this does not support including requirements files that aren't managed by pip-compile via -r directives. While doing so won't break anything, the lock files won't get updated when the pip_requirements manager updates a dependency. They will get updated later as part of the next lock file maintenance.

Context

#28050

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Pip-compile supports including other requirements files via the -r flag.
The pip_requirements manager already extracts those flags, but this adds
logic to the pip-compile manager to make sure dependent files' lock
files get updated when a package is updated in a file that is included
via a -r directive.
lib/modules/manager/pip-compile/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/pip-compile/extract.ts Outdated Show resolved Hide resolved
lib/modules/manager/pip-compile/extract.ts Outdated Show resolved Hide resolved
@mbudnek mbudnek requested a review from viceice March 20, 2024 21:59
@mbudnek mbudnek requested a review from viceice March 21, 2024 18:20
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

otherwise LGTM

lib/modules/manager/pip-compile/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/pip-compile/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/pip-compile/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/pip-compile/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/pip-compile/extract.spec.ts Outdated Show resolved Hide resolved
mbudnek and others added 2 commits March 24, 2024 13:58
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
@mbudnek mbudnek requested a review from viceice March 24, 2024 18:00
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

new comments

@mbudnek mbudnek requested a review from viceice March 29, 2024 21:17
@viceice viceice added this pull request to the merge queue Mar 29, 2024
Merged via the queue into renovatebot:main with commit f9ba846 Mar 29, 2024
37 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.276.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

);
continue;
}
sourceFile.lockFiles!.push(...packageFile.lockFiles!);
Copy link
Contributor

Choose a reason for hiding this comment

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

What if a lock file is duplicated across package files before this operation?

Copy link
Contributor Author

@mbudnek mbudnek Mar 29, 2024

Choose a reason for hiding this comment

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

Hmm, I suppose that could cause a problem with something like this

graph LR
    a.in --> b.in
    a.in --> c.in
    b.in --> d.in
    c.in --> d.in

In that case a.in's lockFiles would be ["a.txt", "b.txt", "d.txt", "c.txt", "d.txt"] and Renovate would end up running

pip-compile a.in
pip-compile b.in
pip-compile d.in
pip-compile c.in
pip-compile d.in

Where the first instance of pip-compile d.in would likely fail since b.txt and c.txt could ask for different versions of a newly-updated package.

I'll look into fixing that on Monday.

secustor pushed a commit to secustor/renovate that referenced this pull request Mar 31, 2024
…ovatebot#28052)

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
@mbudnek mbudnek deleted the feat/pip-compile-r-flag branch April 17, 2024 21:50
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.

None yet

5 participants