-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add flake8 to CI #355
Comments
@ambv Any suggestions here? I'm a bit worried that such a PR would cause merge conflicts for every other PR currently in flight... |
Looks reasonable to me. Open questions@gvanrossum, what will happen if some core dev modifies typing.py right in the cpython repo? Do we sync that back here? Or do you revert those changes in the cpython repo? Shouldn't that stop happening since I'm asking those questions mostly in the context of flake8. If people in the cpython repo can change the module, they should run the same checks as here. The second reason I'm asking is that if there's changes in cpython that are not here, this will create ugly conflict on that other repo's side. I can check for that. Assuming we decide introducing the tool doesn't interfere with core development workflow, it's relatively trivial to introduce formatting changes incrementally (per flake8 rule) so that history looks sensible and it doesn't conflict. There's just one PR in flight. Is it ready for merging? Looks pretty ready to me. I wouldn't worry about stuff that isn't submitted against us yet. Existing situation and ways forwardThese are the violation statistics for typing.py, not too bad:
Most of lines too long are reasonable as they are, the longest is 97 characters, most are below 85. I'm a little reluctant to touch those without a more important reason, what do you think @gvanrossum? Blank lines, however, are trivial to fix without conflicts. And others look like easy isolated fixes to make, too. test_typing.py is more laborious:
The tricky one is F821. That's one of the most useful warnings but in this case it's fooled by PY36_TESTS being included as a string for backwards compatibility. Ignoring that warning would be a shame. So, we could separate those to a file of its own and import them or provide dummy values for older Python versions. I'd ignore E701 and E704 since the most common pattern in tests is a harmless line like: |
I prefer it if core devs make changes here first, but not all of them do that, so I catch those and merge them back here. I also sometimes have to ensure that Python 3.5, 3.6 and 3.7 have the same exact text (everything needs to be dynamically checking for versions). Anyway, right now there are no discrepancies. I always manually check before running the update-stdlib.sh script. FWIW typing.py is still provisional in 3.6 (you're maybe confused with asyncio, which is not). I am not worried about people who have unsubmitted changes to typing.py. There aren't many people who contribute, and we always steer them here. |
From What's New in 3.6:
The module also doesn't have the provisional preamble in the documentation for 3.6. Alright, given the rest of your comment, I'll start cleaning things up. Will submit PRs for semantic changes but won't bother you with whitespace-only manipulations. |
Aargh. I think that's a mistake. I don't recall if I once said it should
not be provisional and have forgotten about it, or if someone just assumed
this. Do you know by which revision the provisional preamble was removed?
…On Wed, Jan 18, 2017 at 11:58 AM, Łukasz Langa ***@***.***> wrote:
From What's New in 3.6 <https://docs.python.org/3/whatsnew/3.6.html>:
The typing module received a number of improvements and is no longer
provisional.
The module also doesn't have the provisional preamble in the documentation
for 3.6.
Alright, given the rest of your comment, I'll start cleaning things up.
Will submit PRs for semantic changes but won't bother you with
whitespace-only manipulations.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMhvYN2u2gge2CZ7MEggAiuBUBtzgks5rTm7TgaJpZM4LmLTx>
.
--
--Guido van Rossum (python.org/~guido)
|
It was added by this rev to the whatsnew:
changeset: 105041:c0060567f35d
branch: 3.6
parent: 105039:bcd4ab982429
user: Yury Selivanov <[email protected]>
date: Thu Nov 10 13:27:22 2016 -0500
summary: Issue #28635: What's New in Python 3.6 updates
But that's a massive commit...
On Wed, Jan 18, 2017 at 12:03 PM, Guido van Rossum <[email protected]
… wrote:
Aargh. I think that's a mistake. I don't recall if I once said it should
not be provisional and have forgotten about it, or if someone just assumed
this. Do you know by which revision the provisional preamble was removed?
On Wed, Jan 18, 2017 at 11:58 AM, Łukasz Langa ***@***.***>
wrote:
> From What's New in 3.6 <https://docs.python.org/3/whatsnew/3.6.html>:
>
> The typing module received a number of improvements and is no longer
> provisional.
>
> The module also doesn't have the provisional preamble in the
documentation
> for 3.6.
>
> Alright, given the rest of your comment, I'll start cleaning things up.
> Will submit PRs for semantic changes but won't bother you with
> whitespace-only manipulations.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#355 (comment)>,
or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/
ACwrMhvYN2u2gge2CZ7MEggAiuBUBtzgks5rTm7TgaJpZM4LmLTx>
> .
>
--
--Guido van Rossum (python.org/~guido)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMjWrQwUnKukGjm6X23-wBBf80drvks5rTnApgaJpZM4LmLTx>
.
--
--Guido van Rossum (python.org/~guido)
|
Looking at #247, it seems the last major piece left is structural types, something I will work on for Python 3.7 (you can count on that). That should be a separate PEP at this point anyway. We can experiment with it in mypy_extensions for the time being. All other things are relatively minor, except for AsyncGenerator which I'm a little sad was missed from 3.6.0. |
It is merged now. You can go ahead with your changes, whenever you want.
To be honest, I see the omission of
I am also interested in working on protocols. Do you have more concrete plans? I was thinking about polishing what Jukka proposes in #11 (comment) into a PEP, and implementing it in mypy. In parallel, I am going to start next week with implementing structural checks for |
The reason I didn't want us to reinvent the wheel too quickly is that I'd like to research ways in which ABCs and zope.interface don't fit the bill. The former is a workable workaround for many cases today, whereas the latter seems like a superset of what we need to me. Preparing a totally new way to do this without drawing from those two experiences seemed irresponsible to me. BTW, it was the same with @overload having a runtime effect in .py files (effectively multiple dispatch). I'm happy how this was implemented in the end, having it purely for typing purposes is brilliant. |
I think this should be done the same way for protocols. The only runtime effect is that I agree that we should incorporate previous experience. Do you think it would be good idea to start from Jukka's proposal (I was thinking about it for some time and I really like it), or you would like to propose something completely different? OK, probably this is off-topic so I stop disturbing you here. (If you are interested in the discussion we could move it to #11) |
Haha, that's right, it is. FWIW Jukka's proposal is a very reasonable starting point but before we commit to it, let's look closer at existing runtime tools. |
The checks are already running on Travis (with Python 3.6), I pushed the config change along with trivial whitespace changes in 5ed8c89. |
All the four PRs LGTM. |
Can you merge them yourself?
…--Guido (mobile)
On Jan 18, 2017 3:58 PM, "Ivan Levkivskyi" ***@***.***> wrote:
All the four PRs LGTM.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMoC9bA0Hmtur549491VfMakeU2Agks5rTqcegaJpZM4LmLTx>
.
|
I merged the PRs. What are we going to do with |
Thanks. I propose to wrap everything to fit in 100 characters.
…On Thu, Jan 19, 2017 at 7:24 AM, Ivan Levkivskyi ***@***.***> wrote:
I merged the PRs. What are we going to do with test_typing.py and long
lines (E501)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMiciAHlxvFhHOHOPGCNKm1-aZOwjks5rT4AlgaJpZM4LmLTx>
.
--
--Guido van Rossum (python.org/~guido)
|
The longest line is already 97 chars now. So that the only problem left is |
Thanks for acting quickly on this :) Let's not ignore F821, I rather decided to exclude test_* entirely than to ignore undefined names in the actual module. So, let's put some dummy values for test_*. There's some other issues there to be solved, I'll send you a batch of new PRs for those. |
This is pretty much done. Tests have their specific config because of four remaining warnings:
To my eye, all of them are harmless for tests but worth checking for the actual module, hence the separate config. Feel free to adjust the configs to your liking from now on. |
@ambv This all makes sense. Thank you for helping with this! |
I just tried to run flake8 locally and I have got around hundred errors. I think it is a good idea to add flake8 to CI. I would like to make a PR fixing those errors and adding flake8 to
.travis.yml
.@gvanrossum, is it better to do this before or after other open PRs are merged?
The text was updated successfully, but these errors were encountered: