On Fri, Feb 01, 2019 at 11:08:26AM -0500, Andrew Halberstadt wrote: > *4. Enabling flake8-isort (bug 1492495 > <https://bugzilla.mozilla.org/show_bug.cgi?id=1492495>)* > > Isort is a tool to format python imports, and flake8-isort is a shim > to use it as a linter. I'm proposing flake8-isort over the more > popular flake8-import-order because we'll get automatic fixing for > free. Manually re-ordering imports is not something I think anyone > should be subjected to. > > Isort is configurable, but the default is pretty close to what we > unofficially tend to use anyway, namely: > > # stdlib imports > import os > import sys > from collections import OrderedDict, defaultdict > > # external dependency imports > import requests > from mozprocess import ProcessHandler > > # internal imports > import mymodule > from . import name > > I think I'd like to enable this at the 'warning' level to start (so it > doesn't cause backouts or show up without --warnings). This will > give people a feel for the new syntax and allow us to start using > --fix to re-order imports before making it a hard requirement. > > This item item is potentially controversial, so let me know if you > have any objections to enabling this.
Considering modules can execute code when they are being imported (and some do), reordering should be done with extra care. Relatedly, how is the following handled? ``` import sys sys.path.append('some path') import more, stuff. ``` Mike _______________________________________________ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds