Skip to content

Refs #1184 -- Reformatted code with Black. #1224

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

Merged
merged 3 commits into from
Nov 30, 2022

Conversation

CuriousLearner
Copy link
Member

@CuriousLearner CuriousLearner commented Oct 1, 2022

This formats the code with black and also ensures that flake8 doesn't conflict with its changes.

@CuriousLearner
Copy link
Member Author

In a subsequent PR, I'll add black in the pre-commit hooks and also ensure that this commit can be ignored in git-blame.

@CuriousLearner CuriousLearner requested review from felixxm, carltongibson and pauloxnet and removed request for felixxm October 1, 2022 16:08
@pauloxnet
Copy link
Member

Have read to comments form @carltongibson on this issue ?
#1184 (comment)

Please in any case wait for reviews before merge this PR. There's a lot of changed file so it can be take long time to review.

All contribute in review this PR are welcome.

@CuriousLearner
Copy link
Member Author

Have read to comments form @carltongibson on this issue ? #1184 (comment)

Yes, I did :) The commit on this PR is from dj-bot as Carlton mentioned. I'll follow up with a PR as mentioned to mark this commit to be ignored in git-blame rev. Let me know if there is anything else.

Please in any case wait for reviews before merge this PR. There's a lot of changed file so it can be take long time to review.

Of course :)

All contribute in review this PR are welcome.

@CuriousLearner CuriousLearner requested a review from a team October 2, 2022 09:48
Copy link
Contributor

@camilonova camilonova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @CuriousLearner. Thanks for this.

The actual "Applied Black" commit seems fine — ...

Can you look at https://github.com/django/django/pull/15387/commits — we need to adjust the isort and flake8 configs, and add a Black config, and ensure that it's applied going forward (otherwise we drift away). And so on...

Can you add (a) separate commit(s) for those so we can take them as a batch?

🎁

@CuriousLearner
Copy link
Member Author

Sure, I'll have a look later in the evening and get this done.

Thanks!

@pauloxnet pauloxnet added in progress python Pull requests that update Python code labels Oct 6, 2022
@pauloxnet pauloxnet linked an issue Oct 6, 2022 that may be closed by this pull request
@CuriousLearner CuriousLearner force-pushed the 1184-format-black branch 5 times, most recently from d3dcc63 to 3332acb Compare November 3, 2022 17:25
@CuriousLearner CuriousLearner force-pushed the 1184-format-black branch 2 times, most recently from ba901d6 to 09188e4 Compare November 6, 2022 14:01
@CuriousLearner
Copy link
Member Author

Hi @carltongibson 👋🏼 !

I tried to incorporate your review. The default line-length is now standardized to 88 chars. I had to do some manual changes in the actual format black commit. I've also added separate commit(s) for adding black to github action and adjusting the config. Please let me know if anything else is needed here.

The actual black commit(s) lint action failed since the config was later adjusted in the subsequent commit, but please let me know if I should adjust the config in format black commit too to make everything passed (I'm not sure what is the preference here).

Many thanks!

cc @pauloxnet

@pauloxnet
Copy link
Member

@CuriousLearner thanks for all your work here. The PR seems OK to me but I prefer to wait @carltongibson or @felixxm review here because they already managed the similar PR in the Django code and also because its a huge PR.

@pauloxnet
Copy link
Member

@CuriousLearner can you rebase this PR and read the comments above ?

@carltongibson
Copy link
Member

@CuriousLearner Sorry for the slow follow-up. If you can rebase and address the comments I will take a proper look next week. Super effort 🎁

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think this looks good. @CuriousLearner — have you got the bandwidth to update? (If not I can do it!) I think we should get it in then.

Ref the pre-commit config, @adamchainz had me use the bot/GitHub app on the Daphne repo, and that works quite well… — I was going to extend it to the other Channels repos, if that's a measure. If @django/djangoproject-com-maintainters think so, I can add maybe it here too? (Permissions are per-repo…)

@CuriousLearner
Copy link
Member Author

Hey @carltongibson

Sorry for the late reply. I had to wrap-up a project this week at work. I'll get this done tomorrow morning.

Cheers!

@CuriousLearner CuriousLearner force-pushed the 1184-format-black branch 4 times, most recently from 800b40c to 532da37 Compare November 26, 2022 11:01
@CuriousLearner
Copy link
Member Author

Hi @carltongibson

I've rebased the PR and address @pauloxnet 's review. Please have a look now.

@pauloxnet
Copy link
Member

Ref the pre-commit config, @adamchainz had me use the bot/GitHub app on the Daphne repo, and that works quite well… — I was going to extend it to the other Channels repos, if that's a measure. If @django/djangoproject-com-maintainters think so, I can add maybe it here too? (Permissions are per-repo…)

I agree, please do it @carltongibson 🙏🏻

@pauloxnet
Copy link
Member

I've rebased the PR and address @pauloxnet 's review. Please have a look now.

Hi @CuriousLearner and thanks for your hard work on this PR.

I've just reviewed again and approved, but let wait for @carltongibson review and edits.

@adamchainz
Copy link
Member

After setting up pre-commit.ci, we can drop the tox jobs to run black/flake8/isort, and related github actions steps.

@carltongibson
Copy link
Member

I agree, please do it @carltongibson 🙏🏻

OK, I've just added the pre-commit app to this repo. (The was a 400 error in the process, but logging in there, it says it worked... 😬)

@carltongibson
Copy link
Member

carltongibson commented Nov 30, 2022

@CuriousLearner Just FYI, since I saw your reaction, I'm rebasing this (and will experiment with a "bad commit") now.

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks for your work @CuriousLearner 🏅

I've rebased and adjusted slightly:

  • Added a line-length ignore for the docs test file with the long fixtures.
  • Dropped the GHA linter step as per Adam's comment. I kept the tox jobs, since they're handy for me at least to run locally. (I know, don't @-me 😜)

For me this is ready to be (rebase and) merged as three commits. @pauloxnet given that I edited can I just ask you to glance and do that? Thanks!

Comment on lines +5 to +6
per-file-ignores =
docs/tests.py: E501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the docs fixtures in this file, which have a longer length but don't seem worth manually reformatting.

See https://results.pre-commit.ci/run/github/690903/1669801921.cpckKRxoTl-Z01SxoOmUxQ

@pauloxnet pauloxnet merged commit 7ade4ce into django:main Nov 30, 2022
@pauloxnet
Copy link
Member

For me this is ready to be (rebase and) merged as three commits. @pauloxnet given that I edited can I just ask you to glance and do that? Thanks!

@carltongibson as you asked, after reviewing I rebased and merged using the Github action for that. I hope that's exactly what you asked me to do. :-)

Thanks again to @CuriousLearner for his works here.

@carltongibson
Copy link
Member

@pauloxnet perfect thanks!

@CuriousLearner if you wanted to follow-up adding the Black commit to a .git-blame-ignore-revs that would 🍒

@CuriousLearner
Copy link
Member Author

Thanks for the review and getting this in @pauloxnet & @carltongibson

@carltongibson I've added the subsequent PR here: #1280

Thanks 🙌🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting code with black
6 participants