diff options
author | Benjamin ABEL <bbig26@gmail.com> | 2015-03-02 19:15:29 +0100 |
---|---|---|
committer | Benjamin ABEL <bbig26@gmail.com> | 2015-03-02 19:26:47 +0100 |
commit | ea10824e12e7d9409e7a8918094c1dbfa2d66f05 (patch) | |
tree | f028c5fe9f86109f90793270426ab296a76d8a3b /README.md | |
parent | 74ddc39485c18cb78972fc0088f82b8af7b24c53 (diff) | |
download | isort-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.md | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -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? ====================== |