Skip to content

Commit 45cbe80

Browse files
Merge branch 'release/4.0.0'
2 parents db10e70 + 778e968 commit 45cbe80

File tree

16 files changed

+1052
-105
lines changed

16 files changed

+1052
-105
lines changed

.editorconfig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@ known_third_party = kate
99
ignore_frosted_errors = E103
1010
skip = runtests.py,build
1111
balanced_wrapping = true
12-
not_skip = __init__.py
12+
not_skip = __init__.py
13+
14+
[*.{rst,ini}]
15+
indent_style = space
16+
indent_size = 4
17+
18+
[*.yml]
19+
indent_style = space
20+
indent_size = 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Packages
77
*.egg
88
*.egg-info
9+
.eggs
910
build
1011
eggs
1112
parts
@@ -16,6 +17,7 @@ develop-eggs
1617
lib
1718
lib64
1819
MANIFEST
20+
.eggs
1921

2022
# Installer logs
2123
pip-log.txt

.travis.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
language: python
2-
python:
3-
- "pypy"
4-
- "2.6"
5-
- "2.7"
6-
- "3.2"
7-
- "3.3"
8-
- "3.4"
9-
script: python setup.py test
2+
env:
3+
- TOXENV=isort-check
4+
- TOXENV=py26
5+
- TOXENV=py27
6+
- TOXENV=py32
7+
- TOXENV=py33
8+
- TOXENV=py34
9+
- TOXENV=pypy
10+
install:
11+
- pip install tox
12+
script:
13+
- tox -e $TOXENV

ACKNOWLEDGEMENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ Code Contributors
4242
- Mocker (@Zuckonit)
4343
- Tim Graham (@timgraham)
4444
- Adam (@NorthIsUp)
45+
- Norman Jäckel (@normanjaeckel)
46+
- Derrick Petzold (@dpetzold)
47+
- Michael van Tellingen (@mvantellingen)
48+
- Patrick Yevsukov (@patrickyevsukov)
49+
- Christer van der Meeren (@cmeeren)
50+
- Timon Wong/NHNCN (@timonwong)
51+
- Jeremy Dunck (@jdunck)
52+
- Benjamin ABEL (@benjaminabel)
4553

4654
Documenters
4755
===================

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ isort your python imports for you so you don't have to.
1111

1212
isort is a Python utility / library to sort imports alphabetically, and automatically separated into sections.
1313
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.
14-
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.
14+
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.
1515

1616
Before isort:
1717

@@ -143,6 +143,7 @@ and puts them all at the top of the file grouped together by the type of import:
143143
- Current Python Project
144144
- Explicitly Local (. before import, as in: from . import x)
145145
- Custom Separate Sections (Defined by forced_separate list in configuration file)
146+
- Custom Sections (Defined by sections list in configuration file)
146147

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

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

290+
Custom Sections and Ordering
291+
============================
292+
293+
You can change the section order with `sections` option from the default of:
294+
295+
FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
296+
297+
to your preference:
298+
299+
sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER
300+
301+
You also can define your own sections and thier order.
302+
303+
Example:
304+
305+
known_django=django
306+
known_pandas=pandas,numpy
307+
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,PANDAS,FIRSTPARTY,LOCALFOLDER
308+
309+
would create two new sections with the specified known modules.
289310

290311
Auto-comment import sections
291312
======================
@@ -385,7 +406,10 @@ or:
385406
menu > Python > Remove Import
386407

387408
Using isort to verify code
388-
======================
409+
==========================
410+
411+
The ```--check-only``` option
412+
-----------------------------
389413

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

404428

405429
Git hook
406-
========
430+
--------
407431

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

446+
Setuptools integration
447+
----------------------
448+
449+
Upon installation, isort enables a setuptools command that checks Python files
450+
declared by your project.
451+
452+
Running ``python setup.py isort`` on the command line will check the files
453+
listed in your ``py_modules`` and ``packages``. If any warning is found,
454+
the command will exit with an error code::
455+
456+
$ python setup.py isort
457+
458+
Also, to allow users to be able to use the command without having to install
459+
isort themselves, add isort to the setup_requires of your setup() like so::
460+
461+
setup(
462+
name="project",
463+
packages=["project"],
464+
465+
setup_requires=[
466+
"isort"
467+
]
468+
)
469+
470+
422471

423472
Why isort?
424473
======================

isort/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
from __future__ import absolute_import, division, print_function, unicode_literals
2424

2525
from . import settings
26-
from .isort import SECTION_NAMES, SECTIONS, SortImports
26+
from .isort import SortImports
2727

28-
__version__ = "3.9.6"
28+
__version__ = "4.0.0"

0 commit comments

Comments
 (0)