Depends on D413
Details
Details
- Reviewers
ardumont - Commits
- rDLDPY3f1f15345a5f: Reorder imports in the "standard" order
formatting fix
Diff Detail
Diff Detail
- Repository
- rDLDPY PyPI loader
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
What's the standard import order?
So far, i've tried to keep the following order everywhere:
import <something> ... <space> from <something> import <fn> ... <space> import swh.<something> import .<something> ... <space> from swh.<something> import <fn> ... <space> <space> <code starts here>
In this diff, for example, i saw one inconsistency (client.py$12).
Comment Actions
The import order that I try to use, and is consistent with what PEP8 advises to use is:
- imports from the Python standard library
- imports from third party modules
- (if there's a lot of them) imports from the currently used "primary" third-party module (mostly used in Django context)
- imports from other Software Heritage modules
- imports from the current module
In each of these blocks, imports are sorted by module name, irrespective of whether we import the whole module or a single name, so that we can minimize diff conflicts.