Skip to content

Commit fe37814

Browse files
authored
Speed up CI (bachya#78)
* Speed up CI * More fixes * Include mypy in lint step * More changes * Updates * Removing tests from flake8 * isort in pyproject.toml * Update * isort update * Quoting * UGH * Come on * I'm losing my mind * COME ON * COME ON * Fix sorts * TOML * YES?! * More sorting fixes * Fixed typing * Final cleanup
1 parent 2fa02a7 commit fe37814

21 files changed

Lines changed: 113 additions & 104 deletions

‎.flake8‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
ignore = E203, E266, E501, W503
2+
ignore = E203, E266, E501, F811, W503
33
max-line-length = 80
44
max-complexity = 18
55
select = B,C,E,F,W,T4,B9

‎.github/pull_request_template.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ Fixes https://github.com/bachya/python-simplisafe/issues/<ISSUE ID>
88

99
- [ ] Confirm that one or more new tests are written for the new functionality.
1010
- [ ] Update `README.md` with any new documentation.
11-
- [ ] Run tests and ensure 100% code coverage: `make coverage` (after running `make init`)
12-
- [ ] Ensure you have no linting errors: `make lint` (after running `make init`)
13-
- [ ] Ensure you have typed your code correctly: `make typing` (after running `make init`)
1411
- [ ] Add yourself to `AUTHORS.md`.

‎.github/workflows/ci.yaml‎

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ on:
55
pull_request:
66
branches:
77
- dev
8+
- master
89
push:
910
branches:
11+
- dev
1012
- master
1113

1214
jobs:
@@ -26,31 +28,9 @@ jobs:
2628
architecture: x64
2729
- name: pytest
2830
run: |
29-
pip install poetry
30-
poetry install
31-
poetry run py.test
32-
33-
lint:
34-
runs-on: ubuntu-latest
35-
steps:
36-
- uses: actions/checkout@v1
37-
- uses: actions/setup-python@v1
38-
with:
39-
python-version: "3.x"
40-
architecture: x64
41-
- name: setup
42-
run: |
43-
pip install poetry
44-
poetry install
45-
- name: lint
46-
run: |
47-
poetry run black --check --fast simplipy
48-
poetry run flake8 simplipy
49-
poetry run docformatter -cr simplipy
50-
poetry run pylint simplipy
51-
- name: typing
52-
run: |
53-
poetry run mypy --ignore-missing-imports simplipy
31+
python -m venv venv
32+
venv/bin/pip install -r requirements_test.txt
33+
venv/bin/py.test
5434
5535
coverage:
5636
runs-on: ubuntu-latest
@@ -61,24 +41,38 @@ jobs:
6141
python-version: "3.x"
6242
architecture: x64
6343
- run: |
64-
pip install poetry
65-
poetry install
66-
- run: |
67-
poetry run py.test -s --verbose --cov-report term-missing --cov-report xml --cov=simplipy tests
44+
python -m venv venv
45+
venv/bin/pip install -r requirements_test.txt
46+
venv/bin/py.test -s --verbose --cov-report term-missing --cov-report xml --cov=simplipy tests
6847
- uses: codecov/[email protected]
6948
with:
7049
token: ${{secrets.CODECOV_TOKEN}}
7150

72-
security:
51+
lint:
7352
runs-on: ubuntu-latest
7453
steps:
7554
- uses: actions/checkout@v1
7655
- uses: actions/setup-python@v1
7756
with:
7857
python-version: "3.x"
7958
architecture: x64
80-
- run: |
81-
pip install poetry
82-
poetry install
83-
- run: |
84-
poetry run bandit -r --configfile=.bandit.yaml simplipy/ scripts/
59+
- name: setup
60+
run: |
61+
python -m venv venv
62+
venv/bin/pip install pre-commit
63+
venv/bin/pre-commit install-hooks --config .pre-commit-config.yaml
64+
- name: bandit
65+
run: |
66+
venv/bin/pre-commit run bandit --all-files
67+
- name: black
68+
run: |
69+
venv/bin/pre-commit run black --all-files
70+
- name: flake8
71+
run: |
72+
venv/bin/pre-commit run flake8 --all-files
73+
- name: isort
74+
run: |
75+
venv/bin/pre-commit run isort --all-files --show-diff-on-failure
76+
- name: mypy
77+
run: |
78+
venv/bin/pre-commit run mypy --all-files

‎.pre-commit-config.yaml‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
---
22
repos:
3+
- repo: https://github.com/PyCQA/bandit
4+
rev: 1.6.2
5+
hooks:
6+
- id: bandit
7+
args:
8+
- --quiet
9+
- --format=custom
10+
- --configfile=.bandit.yaml
11+
files: ^(simplipy|scripts)/.+\.py$
312
- repo: https://github.com/python/black
413
rev: 19.10b0
514
hooks:
@@ -16,17 +25,16 @@ repos:
1625
additional_dependencies:
1726
- flake8-docstrings==1.5.0
1827
- pydocstyle==5.0.1
19-
files: ^(simplipy|scripts|tests)/.+\.py$
20-
- repo: https://github.com/PyCQA/bandit
21-
rev: 1.6.2
22-
hooks:
23-
- id: bandit
24-
args:
25-
- --quiet
26-
- --format=custom
27-
- --configfile=.bandit.yaml
28-
files: ^(simplipy|scripts|tests)/.+\.py$
28+
files: ^(simplipy|scripts)/.+\.py$
2929
- repo: https://github.com/pre-commit/mirrors-isort
3030
rev: v4.3.21
3131
hooks:
3232
- id: isort
33+
additional_dependencies:
34+
- toml
35+
files: ^(simplipy|scripts|tests)/.+\.py$
36+
- repo: https://github.com/pre-commit/mirrors-mypy
37+
rev: v0.750
38+
hooks:
39+
- id: mypy
40+
files: ^(simplipy|scripts)/.+\.py$

‎Makefile‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,13 @@ clean:
33
rm -rf .venv/
44
coverage:
55
.venv/bin/py.test -s --verbose --cov-report term-missing --cov-report xml --cov=simplipy tests
6-
format:
7-
.venv/bin/black simplipy
8-
.venv/bin/black tests
9-
.venv/bin/docformatter -ir simplipy
106
init:
117
python3 -m venv .venv
128
.venv/bin/pip3 install poetry
139
.venv/bin/poetry lock
1410
.venv/bin/poetry install
1511
.venv/bin/pre-commit install
16-
lint:
17-
.venv/bin/black --check --fast simplipy
18-
.venv/bin/flake8 simplipy
19-
.venv/bin/docformatter -r -c simplipy
20-
.venv/bin/pylint simplipy
2112
publish:
2213
.venv/bin/poetry build
2314
.venv/bin/poetry publish
2415
rm -rf dist/ build/ .egg *.egg-info/
25-
test:
26-
.venv/bin/py.test
27-
typing:
28-
.venv/bin/mypy --ignore-missing-imports simplipy

‎README.md‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ You can find complete documentation here: https://simplisafe-python.readthedocs.
2626
4. Enter the virtual environment: `source ./venv/bin/activate`
2727
5. Code your new feature or bug fix.
2828
6. Write a test that covers your new functionality.
29-
7. Update `README.md` with any new documentation.
30-
8. Run tests and ensure 100% code coverage: `make coverage`
31-
9. Ensure you have no linting errors: `make lint`
32-
10. Ensure you have typed your code correctly: `make typing`
33-
11. Add yourself to `AUTHORS.md`.
34-
12. Submit a pull request!
29+
7. Run tests and ensure 100% code coverage: `make coverage`
30+
8. Update `README.md` with any new documentation.
31+
9. Add yourself to `AUTHORS.md`.
32+
10. Submit a pull request!

‎pyproject.toml‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
[build-system]
2+
requires = ["setuptools >= 35.0.2", "wheel >= 0.29.0", "poetry>=0.12"]
3+
build-backend = "poetry.masonry.api"
4+
5+
[tool.isort]
6+
combine_as_imports = true
7+
default_section = "THIRDPARTY"
8+
force_grid_wrap = 0
9+
force_sort_within_sections = true
10+
forced_separate = "tests"
11+
include_trailing_comma = true
12+
indent = " "
13+
known_first_party = "simplipy,tests"
14+
line_length = 88
15+
multi_line_output = 3
16+
not_skip = "__init__.py"
17+
sections = "FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
18+
use_parentheses = true
19+
120
[tool.poetry]
221
name = "simplisafe-python"
322
version = "5.3.6"
@@ -32,14 +51,9 @@ Sphinx = "^2.2.1"
3251
aresponses = "^1.1.1"
3352
bandit = "^1.6.2"
3453
black = "^19.10b0"
35-
docformatter = "^1.3"
3654
flake8 = "^3.7.9"
3755
mypy = "^0.740"
3856
pre-commit = "^1.20.0"
3957
pylint = "^2.4.3"
4058
pytest-aiohttp = "^0.3.0"
4159
pytest-cov = "^2.8.1"
42-
43-
[build-system]
44-
requires = ["setuptools >= 35.0.2", "wheel >= 0.29.0", "poetry>=0.12"]
45-
build-backend = "poetry.masonry.api"

‎requirements_test.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
aiohttp==3.6.2
2+
aresponses==1.1.2
3+
pre-commit==1.20.0
4+
pylint==2.4.4
5+
pytest-aiohttp==0.3.0
6+
pytest-cov==2.8.1
7+
pytest==5.3.2
8+
python-engineio==3.11.1
9+
python-socketio==4.4.0

‎scripts/get_events.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44

55
from aiohttp import ClientSession
6+
67
from simplipy import API
78
from simplipy.errors import SimplipyError
89

‎scripts/get_sensor_properties.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44

55
from aiohttp import ClientSession
6+
67
from simplipy import API
78
from simplipy.errors import SimplipyError
89

0 commit comments

Comments
 (0)