-
-
Notifications
You must be signed in to change notification settings - Fork 614
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
Unpin commented out unsafe packages #975
Unpin commented out unsafe packages #975
Conversation
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.
👍 thanks for putting this together so quickly.
Code changes look good (though I've not looked at this codebase before), and it appears to work as advertised in my codebase.
Codecov Report
@@ Coverage Diff @@
## master #975 +/- ##
=========================================
+ Coverage 99.1% 99.1% +<.01%
=========================================
Files 34 34
Lines 2357 2358 +1
Branches 305 305
=========================================
+ Hits 2336 2337 +1
Misses 11 11
Partials 10 10
Continue to review full report at Codecov.
|
@@ -691,8 +691,7 @@ def test_annotate_option(pip_conf, runner, option, expected): | |||
|
|||
|
|||
@pytest.mark.parametrize( | |||
"option, expected", | |||
[("--allow-unsafe", "\nsetuptools=="), (None, "\n# setuptools==")], | |||
"option, expected", [("--allow-unsafe", "\nsetuptools=="), (None, "\n# setuptools")] |
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.
I don't see any difference in this change. Looks unrelated...
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.
Oh, I see. The second one doesn't have ==
. It's been hard to spot. I suggest that you minimize the diff in order to make it review-friendly.
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.
Yeah, that's why I've split the PR into two commits.
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.
Well, it's not visible in the PR diff and folks mostly don't do reviews per commit (I do sometimes but to all the time).
OTOH, you mix up two separate tasks in this PR:
- reformatting the code
- changing things
This makes it non-atomic, which is not good in my book. As you can see, this confuses even me. And I do a lot more reviews than most of the regular folks (compared to other types of contributions). Which opens up possibilities to sneak in a few more bugs unnoticed. Humans are error-prone and byte-by-byte comparisons are hard without any highlighting.
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.
Yeah, it should have been separate PRs. I thought these changes would be easy to review (which is apparently not). My bad. Would you like me to split this into two PRs or we could go on?
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.
OTOH if you look to this diff line https://github.com/jazzband/pip-tools/pull/975/files#diff-9960f0e0139a2d6000305af0c80dac37R194 you'll see a part of the string with highlighted which is what our goal should be.
That's what I'm talking about!
Not that I know of. But whenever I start it, everybody starts hating me for this. So I'm not very enthusiastic about participating in yet another argument personally...
Haha! That's a rough path 😄
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.
Anyway. I think that one commit should have a logic change and then autoformatting should be a separate commit.
Or just merge it if you want.
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.
That makes sense, but as you mentioned before:
Well, it's not visible in the PR diff and folks mostly don't do reviews per commit (I do sometimes but to all the time).
And I can't merge this unless someone approves 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.
Oh, that approval from @PeterJCLaw doesn't work..
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.
as you mentioned before
I'd like to point out that both individual commits and PRs can be atomic, they just refer to different abstraction levels.
if not self.allow_unsafe: | ||
yield comment("# {}".format(req)) | ||
yield comment("# {}".format(ireq_key)) |
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.
If you stick continue
here, you could dedent the following code block
yield comment("# {}".format(ireq_key)) | |
yield comment("# {}".format(ireq_key)) | |
continue |
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.
You probably right, but I think it's not related to the issue. I'd prefer to touch these lines in a separate PR. First things first.
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.
And it looks subjective, is there a PEP (or guidelines) which suggests to use:
for x in z:
if x:
foo()
continue
bar()
instead of
for x in z:
if x:
foo()
else:
bar()
? Just wondering.
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.
Yes, it's subjective. I don't recall this being mentioned in any PEPs.
- It reduces the indentation which is better for readability
- There's a similar pylint rule for
return
I think it's reasonable to apply this rule to other similar structures.def func(): if cond1: return xxx else: # pylint would emit a warning here return yyy
- Yes, it makes sense to do this in a separate refactoring PR to keep the diff small.
9c82c89
to
841bffb
Compare
@webknjaz thanks for reviewing this! |
Resolves #973. See the proposal in #973 (comment).
Changelog-friendly one-liner: Unpin commented out unsafe packages in
requirements.txt
.Contributor checklist