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

Safe codegen transformations #565

Closed
wants to merge 18 commits into from

Conversation

dmitrykorolev-stripe
Copy link

No description provided.

@ob-stripe
Copy link
Contributor

ob-stripe commented May 8, 2019

@dmitrykorolev-stripe FYI, the Python library uses Black for code formatting. Some of these changes, while safe, result in broken builds because Black would have formatted them differently. You can use make fmtcheck to check the errors reported by Black, and make fmt to have Black actually format everything.

@jleclanche
Copy link
Contributor

@ob-stripe I recommend setting up an isort config that is compatible with black.

See here: PyCQA/isort#694

isort mode 3 is what you want.

@ob-stripe
Copy link
Contributor

@jleclanche Thanks, this is helpful!

However I think the issue here is not import order (which Black doesn't seem to care about with the current configuration) but changes in the formatting of parent classes like here: https://github.com/stripe/stripe-python/pull/565/files#diff-0b7eca4f345d4708e221dcf65baa0388.

Enforcing import order via Black seems like a net win though, I'll look into it.

@jleclanche
Copy link
Contributor

@ob-stripe note that black won't enforce import order on its own, but it will modify their style (eg. for long lines). isort does that too, so that is why if you use both tools you need to ensure they use a compatible mode.

@ob-stripe
Copy link
Contributor

Ah gotcha, thanks for the information!

@dmitrykorolev-stripe dmitrykorolev-stripe changed the title WIP Safe codegen transformations Safe codegen transformations May 11, 2019
rattrayalex-stripe pushed a commit that referenced this pull request May 20, 2019
branch: dmitrykorolev/codegen
pr: #565
rattrayalex-stripe added a commit that referenced this pull request May 21, 2019
* Safe formatting changes from dmitry's branch

branch: dmitrykorolev/codegen
pr: #565

* Split some imports for better uniq'ing

* Sort with basic case-sensitive algo

* Reorder nested resource imports

* Reorder a comment in a way that is more convenient
@rattrayalex-stripe
Copy link
Contributor

This went through in #573 – thanks @dmitrykorolev-stripe !

@ob-stripe ob-stripe deleted the dmitrykorolev/codegen branch June 4, 2019 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants