Skip to content

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 13, 2015
2 parents db10e70 + 778e968 commit 45cbe80
Show file tree
Hide file tree
Showing 16 changed files with 1,052 additions and 105 deletions.
10 changes: 9 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ known_third_party = kate
ignore_frosted_errors = E103
skip = runtests.py,build
balanced_wrapping = true
not_skip = __init__.py
not_skip = __init__.py

[*.{rst,ini}]
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Packages
*.egg
*.egg-info
.eggs
build
eggs
parts
Expand All @@ -16,6 +17,7 @@ develop-eggs
lib
lib64
MANIFEST
.eggs

# Installer logs
pip-log.txt
Expand Down
20 changes: 12 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
language: python
python:
- "pypy"
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
script: python setup.py test
env:
- TOXENV=isort-check
- TOXENV=py26
- TOXENV=py27
- TOXENV=py32
- TOXENV=py33
- TOXENV=py34
- TOXENV=pypy
install:
- pip install tox
script:
- tox -e $TOXENV
8 changes: 8 additions & 0 deletions ACKNOWLEDGEMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ Code Contributors
- Mocker (@Zuckonit)
- Tim Graham (@timgraham)
- Adam (@NorthIsUp)
- Norman Jäckel (@normanjaeckel)
- Derrick Petzold (@dpetzold)
- Michael van Tellingen (@mvantellingen)
- Patrick Yevsukov (@patrickyevsukov)
- Christer van der Meeren (@cmeeren)
- Timon Wong/NHNCN (@timonwong)
- Jeremy Dunck (@jdunck)
- Benjamin ABEL (@benjaminabel)

Documenters
===================
Expand Down
55 changes: 52 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ isort your python imports for you so you don't have to.

isort is a Python utility / library to sort imports alphabetically, and automatically separated into sections.
It provides a command line utility, Python library and [plugins for various editors](https://github.com/timothycrosley/isort/wiki/isort-Plugins) to quickly sort all your imports.
It currently cleanly supports Python 2.6 - 3.4 using pies (https://github.com/timothycrosley/pies) to achieve this without ugly hacks and/or py2to3.
It currently cleanly supports Python 2.6 - 3.5 using pies (https://github.com/timothycrosley/pies) to achieve this without ugly hacks and/or py2to3.

Before isort:

Expand Down Expand Up @@ -143,6 +143,7 @@ and puts them all at the top of the file grouped together by the type of import:
- 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)

Inside of each section the imports are sorted alphabetically. isort automatically removes duplicate python imports,
and wraps long from imports to the specified line length (defaults to 80).
Expand Down Expand Up @@ -286,6 +287,26 @@ Will be produced instead of:

To enable this set 'balanced_wrapping' to True in your config or pass the -e option into the command line utility.

Custom Sections and Ordering
============================

You can change the section order with `sections` option from the default of:

FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

to your preference:

sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER

You also can define your own sections and thier order.

Example:

known_django=django
known_pandas=pandas,numpy
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,PANDAS,FIRSTPARTY,LOCALFOLDER

would create two new sections with the specified known modules.

Auto-comment import sections
======================
Expand Down Expand Up @@ -385,7 +406,10 @@ or:
menu > Python > Remove Import

Using isort to verify code
======================
==========================

The ```--check-only``` option
-----------------------------

isort can also be used to used to verify that code is correctly formatted by running it with -c.
Any files that contain incorrectly sorted imports will be outputted to stderr.
Expand All @@ -403,7 +427,7 @@ Which can help to ensure a certain level of code quality throughout a project.


Git hook
========
--------

isort provides a hook function that can be integrated into your Git pre-commit script to check
Python code before committing.
Expand All @@ -419,6 +443,31 @@ To cause the commit to fail if there are isort errors (strict mode), include the
If you just want to display warnings, but allow the commit to happen anyway, call git_hook without
the `strict` parameter.

Setuptools integration
----------------------

Upon installation, isort enables a setuptools command that checks Python files
declared by your project.

Running ``python setup.py isort`` on the command line will check the files
listed in your ``py_modules`` and ``packages``. If any warning is found,
the command will exit with an error code::

$ python setup.py isort

Also, to allow users to be able to use the command without having to install
isort themselves, add isort to the setup_requires of your setup() like so::

setup(
name="project",
packages=["project"],

setup_requires=[
"isort"
]
)



Why isort?
======================
Expand Down
4 changes: 2 additions & 2 deletions isort/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
from __future__ import absolute_import, division, print_function, unicode_literals

from . import settings
from .isort import SECTION_NAMES, SECTIONS, SortImports
from .isort import SortImports

__version__ = "3.9.6"
__version__ = "4.0.0"
Loading

0 comments on commit 45cbe80

Please sign in to comment.