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(pip_requirements): Extract flags from package files with no deps #28961

Conversation

mbudnek
Copy link
Contributor

@mbudnek mbudnek commented May 9, 2024

Changes

The pip_requirements manager is used by the pip-compile manager for extracting info from requirements.in files. This change makes pip_requirements return any flags it extracted from its input file even if there are no dependencies in the file. This allows a user to provide a requirements.in file with nothing but --extra-index-url flags as a second input file when using pip-compile to compile dependencies in a setup.py file so that Renovate can look those index URLs up in its hostRules and pass appropriate credentials to pip-compile.

Context

#28960

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

The pip_requirements manager is used by the pip-compile manager for
extracting info from requirements.in files.  This change makes
pip_requirements return any flags it extracted from its input file even
if there are no dependencies in the file.  This allows a user to provide
a requirements.in file with nothing but `--extra-index-url` flags as a
second input file when using pip-compile to compile dependencies in a
setup.py file so that Renovate can look those index URLs up in its
`hostRules` and pass appropriate credentials to pip-compile.
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.

I would prefer to extract a new function which always returns the results and leave this function as is.

all managers should return null when no deps are extracted.

@rarkins
Copy link
Collaborator

rarkins commented May 10, 2024

There are cases where we return the package file even with no deps (e.g. when it's the root npm package in workspaces)

@not7cd
Copy link
Contributor

not7cd commented May 10, 2024

If this only concerns pip-compile manager, maybe it should handle this edge-case? Also, maybe extract function can have an optional flag to always return a package file object. A flag only used by pip-compile extract function. But this changes the interface.

@rarkins rarkins requested a review from viceice May 13, 2024 11:47
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.

🤷‍♂️

@rarkins rarkins added this pull request to the merge queue May 13, 2024
Merged via the queue into renovatebot:main with commit dd52edd May 13, 2024
37 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.358.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mbudnek mbudnek deleted the feat/pip-requirements-extract-flags-from-empty-package-file branch May 14, 2024 15:03
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