druid-io / pydruid

A Python connector for Druid
Other
506 stars 194 forks source link

Apply Black and Add Black Check in CI #212

Closed SongYunSeop closed 4 years ago

SongYunSeop commented 4 years ago

Fixes #211

SongYunSeop commented 4 years ago

@john-bodley But black requires Python 3.6+ https://github.com/psf/black/blob/master/setup.py#L6

john-bodley commented 4 years ago

@SongYunSeop maybe it's time to remove the pre-Python 3.6 dependency (@mistercrunch or @gianm may want to chime in here). Note Python 3.5 is slated to reach end-of-life on 2020-09-13 and many packages (including Flask and Superset) now have requirements of 3.6+.

SongYunSeop commented 4 years ago

@john-bodley I totally agree with you.

SongYunSeop commented 4 years ago

@mistercrunch @john-bodley Can you review this PR please? 🙏

MSadeghzadehG commented 4 years ago

I have a problem with using black and flake8 in CI. how did you fix the black linter with these flake8 rules? e.g. E203

john-bodley commented 4 years ago

@MSadeghzadehG do you experience the same CI issues when running tox locally, i.e.,

tox -e black flake8
MSadeghzadehG commented 4 years ago

I don't use tox; I just run black . and then flake8 and it shows many issues related to black code style. because it doesn't match to the flake8 rules. Does tox relate to fixing these issues?

john-bodley commented 4 years ago

If you run tox, per the environment definition all the necessary requirements will be installed and the black (or similar) command will be run with the appropriate arguments. These are the same commands which Travis CI executes.

SongYunSeop commented 4 years ago

@MSadeghzadehG @john-bodley I checked just for now. Is this your faced error message? pydruid/utils/postaggregator.py:16:1: E302 expected 2 blank lines, found 0 If then, you can fixed it after add 2 black lines at postaggregator.py:16. I run both flake8 pydruid and black pydruid

MSadeghzadehG commented 4 years ago

@SongYunSeop It's just an example of black code style conflicts with flake8 rules. Also In the black repo, some rules were ignored