; tox.ini
[flake8]
max-line-length = 120
import-order-style = cryptography
application-import-names = foo
Note: don't try and put
flake8-import-order
configuration under its own section (e.g.[flake8-import-order]
) as Flake8 doesn't look at values outside of its own block (i.e.[flake8]
) -- see explanation here.
# standard library packages/modules
import asyncio
import time
# third-party packages/modules
from tornado.httpclient import AsyncHTTPClient
from tornado.ioloop import IOLoop
# application packages/modules
from foo.bar import baz
AsyncHTTPClient.configure(None, defaults=dict(user_agent="MyUserAgent"))
http_client = AsyncHTTPClient()
async def do_thing():
await asyncio.sleep(1)
time.sleep(1)
response = await http_client.fetch("https://www.integralist.co.uk")
print(response.code)
baz()
io_loop = IOLoop.current()
io_loop.run_sync(do_thing)
Note: to ensure
foo
package isn't identified as "Third-Party" we have to specify it as "Application" via configuration withapplication-import-names
, which is a comma-separated list of your own application packages/modules.