-
Notifications
You must be signed in to change notification settings - Fork 835
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
Code style standardisation for Seldon Core Python modules #947
Comments
Nice one @axsaucedo! I quite like |
/assign @cliveseldon @jklaise @axsaucedo |
@jklaise What does Alibi use and why? |
In alibi we follow PEP8 (enforced by |
I personally think making the line length shorter does not always make sense - if you have to indent 3 or 4 times and try and write a comprehension/another for loop, for example, you might end up with random line breaks which make the code not readable. I'd stick with the 120, personally. |
@alexcoca my suggestion mostly stems from a lot of the time not being able to have 2 editor windows side by side even on a decent resolution monitor... |
Yeah I definitely see it being annoying on having multiple indents, but I agree with @jklaise on that one point about not being able to have stuff side-by-side. Black Formatter does seem to have an option for line length (https://black.readthedocs.io/en/stable/the_black_code_style.html#line-length), which is good. I think best would be to start with defaults to get going, and perhaps see how this goes within a month? |
That being said, I propose then to optimise s.t. we max the number of characters per line s.t. you can fit two windows side by side and not a character less 🕺 |
This was resolved by adding black + git-commit-hooks |
As discussed on the roadmap towards 1.0, one of the points which was suggested was to standardise (and keep standardised) the code style in the Python modules.
We had revisited the Python Black Formatter briefly, and there were some nuances that people disagreed on the style approach.
Black does appear to be quite popular, so may be worth going forward with the 1.0 approach. It has over 10k stars, and its opinionated non-config approach would fit quite well with the integrateion tests we have.
The only other python formatter that would be worth considering is YAPF (Yet another python formatter), which is a project by google, which seems to have also quite a lot of traction, and has been there for longer (which can be both a good and a bad thing).
For a more practical view of how each of the tools would change our codebase:
The next steps would be:
The text was updated successfully, but these errors were encountered: