﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23860	Document the preferred imports order	Wojtek Ruszczewski	Tim Graham	"I think it would be nice to have the (soft?) convention on imports order documented. It's said that Django has one, but I've recently spent some time trying to figure out what it is and couldn't find any precise info or get a consistent view based on the source.

[https://www.python.org/dev/peps/pep-0008#imports PEP 8] only asks to put imports on separate lines at the top of the file, guides to make ""standard library"", ""related"" and ""local"" groups, recommends absolute imports (unless dealing with complex package layouts), and discourages the use of ""*"" in most cases.

A short example on the [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/ coding style] page would be enough. Things to mention:
* alphabetical order for modules, classes and objects (within groups);
* modules before classes, other objects after classes?
* ""import"" before ""from ... import""?
* line breaking of lengthy imports.

Some conventions from other projects: [http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Imports_formatting Google], [https://github.com/reddit/reddit/wiki/PythonImportGuidelines reddit], [http://docs.openstack.org/developer/hacking/#real-world-import-order-examples OpenStack], [http://docs.plone.org/external/plone.api/docs/contribute/conventions.html#about-imports Plone]."	New feature	closed	Documentation	dev	Normal	fixed			Accepted	1	0	0	0	0	0
