-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Annotate primary requirements and VCS dependencies #1058
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1058 +/- ##
==========================================
+ Coverage 99.35% 99.47% +0.12%
==========================================
Files 34 34
Lines 2463 2476 +13
Branches 307 312 +5
==========================================
+ Hits 2447 2463 +16
+ Misses 8 6 -2
+ Partials 8 7 -1
Continue to review full report at Codecov.
|
ab96094
to
63228d1
Compare
The output looks great! I don't think this should introduce a new setting though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea and approach are awesome! I've suggested some improvements below:
It looks great! 👍
This improvement is pretty useful, no need to disable it. Otherwise
I think it's okay to disable annotations to focus on certain things desired to test.
I'd prefer the same way as pip does.
Yes, better to squash. |
Usually, if a requirement came from a nested requirement file (included via |
8184f16
to
638ceab
Compare
I've noticed that $ pip-compile setup.py
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile setup.py
#
click==7.0 # via -r /var/folders/4x/rz_w89dx1z3bydfd6qpdjn_h0000gn/T/tmp10jejvdm (line 1)
six==1.14.0 # via -r /var/folders/4x/rz_w89dx1z3bydfd6qpdjn_h0000gn/T/tmp10jejvdm (line 2) Have no idea how to fix this yet 🤔 |
Probably, we could enrich those constraints somehow with pip-tools/piptools/scripts/compile.py Lines 334 to 341 in d405bf9
|
Thank you @atugushev, good catch. I'll look into this today. |
My proposed solution will also handle reqin as stdin. |
Which one? For the |
|
Sorry, I meant "my proposal [which will exist] will . . ."
For
I'm leaning toward Which looks best to you, @atugushev and @graingert ? New questions though: I thought that
|
sometimes in a .in file I'll refer to another .txt file eg:
What would the outputs look like? |
With the current state of this PR: # requirements.in
requests
structlog # requirements-test.in
-r ./requirements.txt
pytest If no $ pip-compile --no-header requirements.in
certifi==2019.11.28 # via requests
chardet==3.0.4 # via requests
idna==2.8 # via requests
requests==2.22.0 # via -r requirements.in (line 2)
six==1.14.0 # via structlog
structlog==20.1.0 # via -r requirements.in (line 3)
urllib3==1.25.8 # via requests
$ pip-compile --no-header requirements-test.in
attrs==19.3.0 # via pytest
certifi==2019.11.28 # via -r ./requirements.txt (line 1), requests
chardet==3.0.4 # via -r ./requirements.txt (line 2), requests
idna==2.8 # via -r ./requirements.txt (line 3), requests
more-itertools==8.2.0 # via pytest
packaging==20.1 # via pytest
pluggy==0.13.1 # via pytest
py==1.8.1 # via pytest
pyparsing==2.4.6 # via packaging
pytest==5.3.5 # via -r requirements-test.in (line 3)
requests==2.22.0 # via -r ./requirements.txt (line 4)
six==1.14.0 # via -r ./requirements.txt (line 5), packaging, structlog
structlog==20.1.0 # via -r ./requirements.txt (line 6)
urllib3==1.25.8 # via -r ./requirements.txt (line 7), requests
wcwidth==0.1.8 # via pytest Note that if the files are adjacent, including Answers to my "new questions" above would change the relpaths in the output in the case where |
Looks very nice |
@graingert Do you have a clear preference for either the |
I think the annotation paths should be based on output location, I don't use setup.py maybe you could use |
I'm noticing the path handling is a little sloppy here: $ mkdir some.folder
$ echo 'requests' > some.folder/reqsin
$ pip-compile --no-header some.folder/reqsin
$ ls some.folder
reqsin
$ cat some.txt
certifi==2019.11.28 # via requests
chardet==3.0.4 # via requests
idna==2.8 # via requests
requests==2.22.0 # via -r some.folder/reqsin (line 1)
urllib3==1.25.8 # via requests |
I worry the line numbers might cause too much diff noise when depending on
compiled requirements.txt
…On Tue, 11 Feb 2020, 21:42 Andy Kluger, ***@***.***> wrote:
I'm noticing the path handling is a little sloppy here
<https://github.com/jazzband/pip-tools/blob/d405bf9c35e9fd37439e33b1f93a708d299bf329/piptools/scripts/compile.py#L243>
:
$ mkdir some.folder
$ echo 'requests' > some.folder/reqsin
$ pip-compile --no-header some.folder/reqsin
$ ls some.folderreqsin
$ cat some.txtcertifi==2019.11.28 # via requestschardet==3.0.4 # via requestsidna==2.8 # via requestsrequests==2.22.0 # via -r some.folder/reqsin (line 1)urllib3==1.25.8 # via requests
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1058?email_source=notifications&email_token=AADFATCXPTSDWDJCD3HFGV3RCMLVZA5CNFSM4KRUM3AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELOF7NQ#issuecomment-584867766>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADFATEVOEFYPCLKTKEANJDRCMLVZANCNFSM4KRUM3AA>
.
|
Please go for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! 🎉 🎉 🎉
@atugushev any chance for a release soon with this new feature? |
2658bdd
to
e7b2db0
Compare
I thought I'd done a final squash already, but I hadn't, so here it is. No code changes since the |
@AndydeCleyre could you please fix the QA issues? |
…y and VCS reqs; fixes jazzband#881 and jazzband#293 Change Notes ------------ - Annotations now include reqsin/setup.py/stdin info when relevant - Always send reverse_dependencies to writer._format_requirement as a dict, even if empty - Invert checks for primary requirements not getting annotations, as they now do - Bypass annotation noise in tests which don't target annotations anyway, by passing --no-annotate - ireqs returned by get_best_match now have the parameter ireq's _source_ireqs, if any - reverse_dependencies are no longer passed around independently outside the resolver/cache, but rather determined from an ireq's comes_from and _source_ireqs - primary_packages are no longer passed around independently, but rather determined by an ireq's constraint - In tests, reverse dependencies for fake ireqs are now specified by setting the ireq's comes_from - These changes do _not_ improve handling of relative paths to reqsin files in annotations (see jazzband#1067) Co-authored-by: Albert Tugushev <albert@tugushev.ru>
e7b2db0
to
ca69a92
Compare
@atugushev whoops, didn't run tox after using the github interface to merge in the format string. Should be good when the tests finish now. |
@AndydeCleyre thanks! @graingert I'll try to release within 48 hrs. |
|
Lines numbers apparently were included in v4.5.0. FWIW I just run it over a large requirement set and as @graingert commented the diff noise is excessive even for small changes in |
I agree the diff noise is irritating, but the line numbers did just prove useful also:
Our constraints file had duplicate restrictions on the |
My comment about there being no line numbers was only about annotations for stdin and setup.py -- are you getting line numbers for those? |
Isn't this illegal in a requirements.txt? This should throw an error |
I think there should be no line numbers in the generated requirements.txt, and duplicate constraints in a requirements.in considered an error (as it is in pip (I think)) |
Would you open a new issue for discussion? |
The duplicates were in a constraints file pulled in via |
FYI: @adamchainz has opened an issue to discuss this: #1074 (includes a PR) |
The diff is so big due to jazzband/pip-tools#1058.
The diff is so big due to jazzband/pip-tools#1058.
Resolves #881
Resolves #293
This change brings annotations to primary requirements in the compilation output.
The annotation may be merely a reqs-in source:
or it may additionally include reverse dependencies:
Existing tests are modified to either adjust their expectations, or compile with
--no-annotations
if annotations are irrelevant. Two tests have been inverted and renamed:Changelog-friendly one-liner: Primary requirements and VCS dependencies now get annotated with any source
.in
files and reverse dependenciesContributor checklist
Please review these changes with the following questions in mind:
--no-annotate
?InstallRequirement
'scomes_from
attribute be astr
, or anInstallRequirement
? The following alternatives seem to result in the same output. Which is saner or preferred, or handles potential edge cases better?code in context