Adoption of a new Import Ordering Standard
In the early days, there was a sense that there was a distinction being made between was it was in Django’s core and what was in django.contrib
. We were honoring that distinction by having import sections separate.
This past month or so we’ve been getting a lot of contributions on Pinax Stripe and there were some style preferences of grouping django.contrib
with the rest of django
that came out of that. This prompted some discussion in #design-decisions
channel in the Pinax Slack Workspace and we decided to make the change.
This decision is in part as it seems the view on django.contrib
has shifted since the early days. It is also in part of just adjusting on style preference a bit to reduce friction for our contributors.
One nice addition since those early days is now we have a fantastic tool to help us comply and keep our code nice and tidy with isort.
The following config for isort
will be added to the tox.ini
for Pinax projects to both better communicate this new standard and provide an easy way for people to use the utility on modules to ensure things are kept sorted properly.
[isort] multi_line_output=3 known_django=django sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
We can now actually lint the import ordering as part of our continuous integration processes. Automating more FTW!