-
Notifications
You must be signed in to change notification settings - Fork 923
Apply PEP-8 compatible code formatting #92
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
Conversation
While not visible in the cheatsheet itself, we should still adhere to common best practices, to be a role model for potential contributors.
| ax.step(X, Y, color="C1", linewidth=0.75) | ||
| ax.set_xlim(0, 8), ax.set_xticks(np.arange(1,8)) | ||
| ax.set_ylim(0, 8), ax.set_yticks(np.arange(1,8)) | ||
| ax.set_xlim(0, 8), ax.set_xticks(np.arange(1, 8)) |
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.
Could this use ax.set now? At the very least, if we're going to stuff multiple statements in one line, we should use ;, not , to fake it.
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, we have that kind of code in our plot-types gallery. I thought I don't make too many changes at once to keep reviewing simpler.
|
Would anyone object to applying Black code formatting? If not, I can open a PR. Whitespace formatting and PEP-8 compliance could be enforced through pre-commit checks. |
|
We intentionally don't use black in the matplotlib core codebase. And personally, I'm not a big fan of it, but it would be ok for me in this repo. |
|
I'm fine with this as well - |
|
a) I'm fine with these, |
|
Actually, I also do not care for it much, but it seems to be the best game in town. Adds a bit too much whitespace around maths expressions, IMHO. Maybe just checking for PEP-8 violations is sufficient. I started looking at matplotlib/pytest-mpl; @jklymak, this could be a way to do regression testing on the figures and cheatsheets. Ideally, not every tiny change is tracked, and comparisons can be made between the current and baseline versions, maybe with the baseline tracked in a separate branch and replaced on each successful build (like the |
|
Cool - I hope this wouldn't end up too bloated as I don't think there is much call for changing the images often. OTOH they may change as Matplotlib changes, which may end up being a pain... |
|
BTW, I'd just vote for flake8 as that is less invasive than black, but that is just my (relative) familiarity with flake8 speaking |
|
I will follow up on this PR with another that adds flake8 and applies most of the fixes for PEP-8 compliance. |
|
I would also prefer pep-8 over black because I find black a bit too intrusive. |
While not visible in the cheatsheet itself, we should still adhere to common best practices, to be a role model for potential contributors.