Set isort profile argument to "black" #4270
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There are some corner-cases where isort and black revert each other's changes and you can't resolve your code such that they're both happy. There's a related issue in the iSort repo (#1518) (PyCQA/isort#1518). Appears the solution is to use the "black" profile, which can be set in setup.cfg or .pre-commit-config.yaml. This change adds the profile arg to the .pre-commit-config.yaml file. This conflict can also be caused by intentionally setting inconsistent style settings for iSort and Black, but I don't believe I've changed your defaults and most of the time your settings work great.
I don't think this proposed change requires any changes to the docs or tests. This fixes the above issue for me when it does come up, and I thought it would be nice to have it right in the cookiecutter template, which I really like using as a base for my Django projects. I have some additional config tweaks I'd like to suggest as well and will submit those separately.
Checklist:
Rationale
I've run into this Black/iSort conflict a handful of times in the years I've used your template. Each time I encounter it, I need to go look up how to fix it. Seems like it'd be good to just roll the fix right into the Django Cookiecutter master branch?