Implement a --group
flag for dependency-group parsing for pip-compile
#2175
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.
Resolves #2062 1
This is an initial proposed implementation, but even after finishing it, I have two major outstanding questions.
Q1: Should
--group
be considered a source file?I didn't merge parsed
--group
inputs intosrc_files
, but I did countlen(src_files) + len(groups)
in a couple of contexts to make it behave similarly.I'm not sure if this was the right approach, or if I missed or misunderstood the goals of the
src_files
checking in any way.Extra attention in this area during review would be appreciated -- as a new contributor, I did my best to follow the existing code and keep the changes small, but may have made mistakes.
Q2: What tests are missing?
The iniital tests are pretty simple and limited. Probably, more tests would be worthwhile, but it's hard to tell what cases would be useful vs redundant with existing tests.
What additional checks seem important?
Note: Accepts
pyproject.toml:X
andpyproject.toml::X
Both
:
and::
syntax are accepted, noted in helptext with double-:
as[pyproject-path::]groupname
.I decided on this after weighing the options from #2062 and would be willing to adjust if there's a strong objection, but think this is the best approach.
pip-compile
can have its own syntax, but accepting thepip install
syntax is an easy gain for compatibility.Because the filename part is already optional, the behavior which handles output of options also naturally handles the
:
vs::
variation.Commits
--group
topip-compile
optionsChecklists
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.Footnotes
Aside: sorry it took so long to submit a PR! This has been on my to-do list for a while. ↩