Skip to content

Commit 79c1ece

Browse files
committed
Introduce isort for automatic import ordering
Removes the need to think about import ordering or formatting. Just let the tool do it. https://github.com/timothycrosley/isort > isort your python imports for you so you don't have to.
1 parent bee3169 commit 79c1ece

File tree

7 files changed

+28
-5
lines changed

7 files changed

+28
-5
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ matrix:
1616
dist: xenial
1717
sudo: required
1818
- env: TOXENV=flake8
19+
- env: TOXENV=isort
1920

2021
install:
2122
- "travis_retry pip install setuptools --upgrade"

cas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import datetime
12
import logging
2-
import requests
3-
from six.moves.urllib import parse as urllib_parse
43
from uuid import uuid4
5-
import datetime
4+
5+
import requests
66
from lxml import etree
7+
from six.moves.urllib import parse as urllib_parse
78

89
logger = logging.getLogger(__name__)
910

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
# serve to show the default.
1414

1515
from __future__ import absolute_import
16-
import sys
16+
1717
import os
18+
import sys
1819

1920
# If extensions (or modules to document with autodoc) are in another directory,
2021
# add these directories to sys.path here. If the directory is relative to the

setup.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@ universal = 1
33

44
[metadata]
55
license_file = LICENSE.txt
6+
7+
[isort]
8+
combine_as_imports = true
9+
force_grid_wrap = 0
10+
include_trailing_comma = true
11+
line_length = 88
12+
multi_line_output = 3
13+
not_skip = __init__.py
14+
skip = .tox

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env python
22

33
from __future__ import absolute_import
4+
45
import codecs
6+
57
from setuptools import setup
68

79
with codecs.open('README.rst', encoding='utf-8') as f:

tests/test_cas.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""Tests for the cas protocol-related code"""
22
from __future__ import absolute_import
3+
4+
import sys
5+
36
import cas
47
from pytest import fixture
5-
import sys
8+
69

710
#general tests, apply to all protocols
811
#

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
envlist=
33
py{27,34,35,36,37}
44
flake8
5+
isort
56

67
[flake8]
78
max-line-length= 100
@@ -20,3 +21,8 @@ commands=py.test --tb native {posargs:tests}
2021
deps=flake8
2122
commands=flake8 {toxinidir}/cas.py
2223
skip_install = true
24+
25+
[testenv:isort]
26+
deps = isort
27+
commands = isort --check-only --diff
28+
skip_install = true

0 commit comments

Comments
 (0)