Skip to main content

Reorder import statements in Python files

Project description

travis-badge codecov-badge readthedocs-badge pypi-badge

Python Fix Imports is a Python executable that can automatically reorganize the import statements of your Python script, by splitting single import statement importing several package into as many import statement as imported module (“one import, one line” principle), and sorting these import statements respecting position of group of them.

The main advantage for this method is to strictly restrict the forms of import statement and facilitate multiple code branch merges and rebase, while still allowing to specify a given order if it is the wish of the developer.

Please read the full rational online documenation for more information.

Sublime Text 3 users can use my Python Fix Imports plugin.

Example

Fix imports allows you to automatically turn:

from any_module import d, f
from other_module import z, x
from any_module import (b,
                        e)
from any_module import a, \
                       c

from a_module_that_should_be import at, after, all_others

into:

from any_module import a
from any_module import b
from any_module import c
from any_module import d
from any_module import e
from any_module import f
from other_module import x
from other_module import z

from a_module_that_should_be import after
from a_module_that_should_be import all_others
from a_module_that_should_be import at

Fiximport installation

$ pip install fiximports

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fiximports-0.1.12.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

fiximports-0.1.12-py2.py3-none-any.whl (17.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fiximports-0.1.12.tar.gz.

File metadata

  • Download URL: fiximports-0.1.12.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fiximports-0.1.12.tar.gz
Algorithm Hash digest
SHA256 73412050b7660fde577bd3b8d627ae24384c30d84a1ff79ef7a01e1c6825b58a
MD5 01611ca7631e4122ddf7ba2255b35b95
BLAKE2b-256 007f031fe329193c1053206967ba041d7ae17e16825fc8279f3d42893a2b5b67

See more details on using hashes here.

File details

Details for the file fiximports-0.1.12-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fiximports-0.1.12-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f90f724b6b6b2987811695bb3b1a8826b676aa5063ad6dde1c270ce2af491801
MD5 d97e77bd97e04afe924e101b3980d109
BLAKE2b-256 dfd867a4dfb3ecb45963381d929cad438419a8fa9e8a8d48fc4f8320de3a2103

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page