#33476 closed Cleanup/optimization (fixed)
Formatting Code with Black
Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Core (Other) | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | Carlton Gibson | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Based on DEP-8 accepted by the Technical Board.
The first stable version of Black
has been released, see 22.1.0.
I assigned it to myself, but we will be working on this with Carlton and the Ops Team.
See implementation.
Change History (29)
comment:1 by , 3 years ago
follow-up: 4 comment:3 by , 3 years ago
The DEP also mentions that "All code Django generates will also be Black-formatted (startproject, migrations, inspectdb, etc.)" but there is nothing in the "Reference Implementation" part that specifies how to do this.
There is a mention on the mailing-list of maybe using django-migrations-formatter. Would upstreaming the feature be a welcome contribution (the license - BSD - matches) for this ticket ?
Also, would reformatting files in django/conf/project_template/
and django/conf/app_template/
(by hand, they are not all valid python) to follow Black style be a welcome contribution ? (Note that this can not guarantee that the generated files will be Black formatted, especially when templates variables are very long and Black would want to wrap lines)
comment:4 by , 3 years ago
Replying to Nikita Marchant:
The DEP also mentions that "All code Django generates will also be Black-formatted (startproject, migrations, inspectdb, etc.)" but there is nothing in the "Reference Implementation" part that specifies how to do this.
There is a mention on the mailing-list of maybe using django-migrations-formatter. Would upstreaming the feature be a welcome contribution (the license - BSD - matches) for this ticket ?
Also, would reformatting files in
django/conf/project_template/
anddjango/conf/app_template/
(by hand, they are not all valid python) to follow Black style be a welcome contribution ? (Note that this can not guarantee that the generated files will be Black formatted, especially when templates variables are very long and Black would want to wrap lines)
As far as I'm aware, we'd like to use a different approach, i.e. run black
on generated files but only when it's installed.
comment:20 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In ca88caa1: