Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort all Python imports #651

Merged
merged 3 commits into from
Sep 8, 2017
Merged

Sort all Python imports #651

merged 3 commits into from
Sep 8, 2017

Conversation

mbeacom
Copy link
Member

@mbeacom mbeacom commented Sep 8, 2017

The goal of this PR is to sort all Python imports for readability in the following order:

  • Future
  • Python Standard Library
  • Third Party
  • Current Python Project
  • Explicitly Local (. before import, as in: from . import x)
  • Custom Separate Sections (Defined by forced_separate list in configuration file)
  • Custom Sections (Defined by sections list in configuration file)

You can automatically format your Python imports with the package isort.

@aldenpeterson-wf
Copy link
Contributor

+1 though I hope you did this automatically somehow, hah!

@mbeacom
Copy link
Member Author

mbeacom commented Sep 8, 2017

@aldenpeterson-wf Of course! Hah.
I regularly use isort

@mbeacom mbeacom merged commit a4c377e into locustio:master Sep 8, 2017
@mbeacom mbeacom deleted the sort-imports branch September 8, 2017 16:36
@heyman
Copy link
Member

heyman commented Sep 16, 2017

Please note that gevent's monkey patching must be applied before the import of requests (see #655). Perhaps isort can be configured to not touch that if we run it again (or we can just manually fix it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants