Skip to content
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

Use Black for formatting code #521

Merged
merged 2 commits into from
Jan 16, 2019
Merged

Use Black for formatting code #521

merged 2 commits into from
Jan 16, 2019

Conversation

ob-stripe
Copy link
Contributor

r? @brandur-stripe
cc @stripe/api-libraries

Black is a code formatter that is quickly gaining traction in the Python community. (Basically go fmt for Python.)

This PR introduces support for automatically formatting stripe-python's code using black. It adds two new make targets:

  • fmt is used to automatically format code
  • fmtcheck is used to check that the code is formatted as black expects. This is used in CI, to ensure that code is compliant before merging.

Tagged as WIP to get your opinion, but the PR is mostly ready -- the only thing's missing is updating README.md with instructions.

.flake8 Show resolved Hide resolved
@brandur-stripe
Copy link
Contributor

Wow, cool. I didn't go through the whole diff, but scanned about half of it, and all the formatting changes that Black makes seem pretty sane to me.

I love formatters. +1 from my perspective.

@ob-stripe ob-stripe changed the title [WIP] Use Black for formatting code Use Black for formatting code Jan 16, 2019
@ob-stripe
Copy link
Contributor Author

Pulling this in!

@ob-stripe ob-stripe merged commit 3a94f30 into master Jan 16, 2019
@ob-stripe ob-stripe deleted the ob-black branch January 16, 2019 13:50
brandur-stripe pushed a commit that referenced this pull request Jan 25, 2019
The project recently switched over to Black for code formatting in #521.
Black expects double-quoted strings throughout the project. We
double-quoted this file when that patch was merged, but our release
script was still incorrectly producing single quoted strings.

I'm just about to patch the release script, but putting this fix in here
so that we can fix `master`.
@brandur brandur mentioned this pull request Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants