summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBenjamin ABEL <bbig26@gmail.com>2015-03-02 19:15:29 +0100
committerBenjamin ABEL <bbig26@gmail.com>2015-03-02 19:26:47 +0100
commitea10824e12e7d9409e7a8918094c1dbfa2d66f05 (patch)
treef028c5fe9f86109f90793270426ab296a76d8a3b /README.md
parent74ddc39485c18cb78972fc0088f82b8af7b24c53 (diff)
downloadisort-ea10824e12e7d9409e7a8918094c1dbfa2d66f05.tar.gz
Add Setuptools integration issue #261
These changes enable any user that installs `isort` to check his source code from setup.py with the command `python setup.py isort` I also checked isort package code with his command in tox and travis. Acknowledgements: this is mostly inspired by flake8 setuptools integration, see [flake8 doc](http://flake8.readthedocs.org/en/2.2.3/setuptools.html)
Diffstat (limited to 'README.md')
-rw-r--r--README.md32
1 files changed, 30 insertions, 2 deletions
diff --git a/README.md b/README.md
index f055af35..cf959abb 100644
--- a/README.md
+++ b/README.md
@@ -385,7 +385,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.
@@ -403,7 +406,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.
@@ -419,6 +422,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?
======================