This can optionally be used to format any added code before submitting a pull. I use this heavily and wouldn't want to hold it back from others, now that yapf is referred to in https://github.com/bitcoin/bitcoin/blob/master/doc/productivity.md#format-python-diffs-with-yapf-diffpy
test: Add .style.yapf #15479
pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:Mf1902-testYapf changing 1 files +261 −0-
MarcoFalke commented at 8:06 PM on February 25, 2019: member
- MarcoFalke added the label Tests on Feb 25, 2019
-
MarcoFalke commented at 8:11 PM on February 25, 2019: member
Just to mention the obvious: No linter is added, using this is not enforced in any way. Same as #4498
-
practicalswift commented at 11:14 PM on February 25, 2019: contributor
@MarcoFalke Out of curiosity: have you tried
black? Some major Python open source projects switched over toblackduring 2018. Looks like it has a good chance of becoming the de facto standard -- agofmtfor the Python world :-) -
fanquake commented at 11:53 AM on February 26, 2019: member
Concept ACK
-
MarcoFalke commented at 2:02 PM on February 26, 2019: member
black does not work on diffs
-
jnewbery commented at 3:04 PM on February 26, 2019: member
I'm vaguely against this if it encourages people to submit style changes that aren't part of the style guide. I find it irritating when I'm reviewing a PR and a bunch of the diffs are "I've inserted this extra whitespace because my editor told me to" (eg #15419 (comment) and #14179#pullrequestreview-153839345 and several others). PRs should not mix functional changes with code style changes, which is what this would encourage.
-
MarcoFalke commented at 3:13 PM on February 26, 2019: member
I am using this tool for years now, and this is the first time that I had someone complain about how I use it. Though, I am happy to split the changes up into several commits in the future, if that is what you prefer.
-
practicalswift commented at 10:37 PM on February 26, 2019: contributor
@MarcoFalke Is this config meant to mirror PEP-8?
If it is meant to mirror PEP-8; why the deviations from
yapf3 --style pep8 --style-help?If it is not meant to mirror PEP-8; why? Why should we buy
--style MarkoFalkeinstead of the market leading brand--style pep8? :-)Diff between
--style pep8and--style MarkoFalke:--- yapf3-pep8.txt 2019-02-26 23:33:41.147520979 +0100 +++ yapf3-marko.txt 2019-02-26 23:33:56.339389554 +0100 -allow_split_before_dict_value=True +blank_lines_around_top_level_definition=2 -coalesce_brackets=False +coalesce_brackets=True -column_limit=79 +column_limit=160 -each_dict_entry_on_separate_line=True +each_dict_entry_on_separate_line=False -no_spaces_around_selected_binary_operators=set() -split_before_bitwise_operator=True +split_before_bitwise_operator=False -split_before_expression_after_opening_paren=False -split_before_logical_operator=True +split_before_logical_operator=False -split_complex_comprehension=False -split_penalty_after_opening_bracket=30 +split_penalty_after_opening_bracket=0 -split_penalty_comprehension=80 -split_penalty_excess_character=4500 +split_penalty_excess_character=3500 -
test: Add .style.yapf fa45123f66
- MarcoFalke force-pushed on Feb 26, 2019
-
MarcoFalke commented at 11:26 PM on February 26, 2019: member
Changed to the yapf pep8 style:
$ yapf --version yapf 0.24.0 $ yapf --style-help --style=pep8 > .style.yapf -
practicalswift commented at 10:23 AM on February 27, 2019: contributor
The current config in this PR seems equivalent to the default style of
yapf 0.26.0(--style pep8) with the following exceptions:allow_split_before_default_or_named_assigns=True arithmetic_precedence_indication=False indent_blank_lines=FalseI assume these three were added in 0.25 or 0.26. @MarcoFalke I guess I'm missing something but what benefits do adding a custom config file
.style.yapfbring if we're using the defaults? Wouldn't just runningyapfwithout any config file yield the same results? :-) -
MarcoFalke commented at 2:07 PM on February 27, 2019: member
No, it would search for your personal style in your home dir or other parent directories
-
practicalswift commented at 3:23 PM on February 27, 2019: contributor
@MarcoFalke Thanks for clarifying. That wasn't clear from reading the PR description.
- MarcoFalke merged this on Mar 4, 2019
- MarcoFalke closed this on Mar 4, 2019
- MarcoFalke referenced this in commit 14023c966c on Mar 4, 2019
- MarcoFalke deleted the branch on Mar 4, 2019
-
jnewbery commented at 4:04 PM on March 21, 2019: member
I'm vaguely annoyed that this was merged by the PR contributor without any ACKs and my outstanding concept NACK. I don't think Python style matters that much but I think as a policy PRs from maintainers should have the same burden of review as everyone else's PRs.
-
MarcoFalke commented at 4:48 PM on March 21, 2019: member
I don't see how this could be controversial. How is this different from
.python-version? No one forces you to use that python version specified there.Similarly our guidelines recommend to use pep8, which is what this yapf specified: #15479 (comment). No one forces you to use pep8 or the style specified here.
-
practicalswift commented at 5:09 PM on March 21, 2019: contributor
FWIW I agree with @jnewbery here.
One could argue that this PR is non-controversial (reasoning: adding a file is not an endorsement of a specific tool).
And one could argue that this PR is "controversial" (reasoning: adding a
yapfspecific file to the repo is an endorsement of theyapfover more popular alternatives such asblack).However, I'm not sure that really matters for the policy discussion.
What matters is the general policy question raised:
The likelihood of merge for a PR submitted by person
Ashould be a function of the technical PR content alone (as judged by reviewers in a technical review). More specifically it should be independent of the "status" ofA- such as ifAis a maintainer or not.That's 100% non-controversial, right? :-)
-
jnewbery commented at 5:10 PM on March 21, 2019: member
I don't want to argue again about the merit of this change. I already expressed why I didn't think it was beneficial and that was ignored.
My point in #15479 (comment) is simply that I don't think maintainers should be merging their own PRs without review from other contributors.
- PastaPastaPasta referenced this in commit cf88dae1dd on Jun 27, 2021
- PastaPastaPasta referenced this in commit b7ae1efd64 on Jun 28, 2021
- PastaPastaPasta referenced this in commit d89a5e88f1 on Jun 29, 2021
- PastaPastaPasta referenced this in commit 96d7513b63 on Jul 1, 2021
- PastaPastaPasta referenced this in commit 1f589f6cf8 on Jul 1, 2021
- PastaPastaPasta referenced this in commit ef1cc472a3 on Jul 8, 2021
- PastaPastaPasta referenced this in commit f2d65948d3 on Jul 10, 2021
- DrahtBot locked this on Dec 16, 2021