Skip to content

Commit 4ed25bf

Browse files
authored
Use isort to keep imports in sorted order (#9)
* Manage import order using isort * Install necessary packages
1 parent 7666cb6 commit 4ed25bf

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install flake8 pytest
27+
python -m pip install black flake8 isort pytest
2828
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2929
- name: Lint with flake8
3030
run: |
3131
# stop the build if there are Python syntax errors or undefined names
3232
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3333
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3434
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
- name: Run style checks
36+
run: |
37+
python -m isort --check .
38+
python -m black --check .
3539
- name: Test with pytest
3640
run: |
3741
pytest

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ license_files = LICENSE
44
[flake8]
55
max-line-length = 88
66

7+
[isort]
8+
profile = black
9+
order_by_type = False
10+
711
[mypy-setuptools]
812
ignore_missing_imports = True

simplefractions/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
from simplefractions._simplest_in_interval import _simplest_in_interval
4242

43-
4443
#: Names to be exported when doing 'from simplefractions import *'.
4544
__all__ = ["simplest_from_float", "simplest_in_interval"]
4645

simplefractions/test/test_simplefractions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import fractions
1616
import math
1717
import random
18-
import unittest
1918
import sys
19+
import unittest
2020

2121
from simplefractions import simplest_from_float, simplest_in_interval
2222

0 commit comments

Comments
 (0)