-
Notifications
You must be signed in to change notification settings - Fork 423
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
Blackify code base #1799
Blackify code base #1799
Conversation
Note: @peterbe recommends therapist https://github.com/peterbe/hashin/pull/80/files |
Be careful commit edbf3b8 should not be part of this PR |
So I basically just added the stuff you linked -- not sure I did it correctly though especially regarding therapist/travis/tox But it seems like its fine? Still need to add some documentation though. |
Excellent! Let's get the documentation part updated for developers in the community section and then we can iterate :) We should probably add the necessary deps in the The diff is hard to review 😅 |
Hey, yes the diff is quite massive. Black does provide the option to omit normalizing quotes. After testing it - the diff would still be massive. When omitting the quite normalization black still touches all but 24 files. I have also added some documentation now. Edit: Travis will fail the py35 build as black requires python 3.6 |
docs/community.rst
Outdated
6. When you're done making changes, format your code with `black <https://github.com/ambv/black>`_ (black requires python >= 3.6):: | ||
|
||
python -m pip install black | ||
black . |
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 would suggest to install black
only and run it via tox -e lint
(tox and therapist will be installed via dev-requirements)
docs/community.rst
Outdated
7. Commit your changes and push your branch to GitHub:: | ||
8. (Optional) Install a git hook with `therapist <https://github.com/rehandalal/therapist>`_ :: | ||
|
||
python -m pip install therapist |
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.
this line can be omitted since already in dev-requirements
Almost there! 🎉
Thanks 🙏 |
Let me know if you need help or support ;) Actually I would be very interested with this PR, because I started to work on #710 using |
Hey, sorry about not getting back to you on this earlier. We should probably move therapist and black to its own requirements.txt file (maybe something like lint-requirements.txt) as, like I said travis will fail the py3.5 build because it cannot install black. I will adjust the documentation accordingly if that is okay. I will only be able to work at this later tonight though after work |
Okay - so I went ahead and got rid of my changes because I did not feel like merging 40+ merge conflicts. This commit now has everything we had earlier with the additional changes that we now have a lint-requirements.txt file as well as adapting the documentation. The code has not yet been formatted with black so it will be easier for me to rebase it once we are ready to merge. |
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.
Don't you think that we could just get rid of flake8
on py35? I mean, if we do lint check on python 3.6 it's good enough no?
@@ -0,0 +1,2 @@ | |||
therapist==1.5.0 | |||
black==18.9b0 |
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.
8. (Optional) Install a git hook:: | ||
|
||
therapist install | ||
|
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.
looks like an extra line
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.
Don't you have to tell therapist to create the hook in your .git dir?
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.
blank line sorry :)
@@ -16,11 +16,12 @@ deps = | |||
statsd | |||
install_command = pip install {opts} {packages} | |||
|
|||
[testenv:flake8] | |||
commands = flake8 kinto tests docs/conf.py |
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 it's mentioned in travis, we should keep it flake8
(py35).
But I would in favor of removing it in travis too instead :)
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 I should have removed it in travis.
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.
Alright - I ran black and merged the conflict |
:) here we go :) thanks again ;) |
Letting black run over everything
So in light of my other pull request I suggested that we run black over everything and @leplatrem seemed to be in favor so here we are.
I figured it would be best if we did this before adding all the type annotations to not have too many changes at once.
I let black run over everything, adding a pre-commit (https://pre-commit.com) config file as well as a config file for black.
I also had to add an ignore E203 in order for flake8 to be happy.
If this is okay then I would still have to add some documentation on how to set things up for development but I do think the result is actually quite nice!
Thoughts?