Skip to content

Commit bbb1014

Browse files
authored
chore: move mypy to pre-commit so its more obvious whats wrong (#425)
1 parent 35c798c commit bbb1014

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

.github/workflows/python-package.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ on:
1010
branches: [master]
1111

1212
jobs:
13-
build:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python 3.13
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.13
21+
cache: "pip" # caching pip dependencies
22+
- uses: pre-commit/action@v3.0.1
23+
24+
test:
1425
runs-on: ubuntu-latest
1526
strategy:
1627
fail-fast: false
@@ -27,11 +38,7 @@ jobs:
2738
- name: Install dependencies
2839
run: |
2940
python -m pip install --upgrade pip
30-
python -m pip install flake8 pytest .[test] -r requirements.txt -r requirements_test.txt
31-
- uses: pre-commit/action@v3.0.1
32-
- name: mypy
33-
run: |
34-
mypy flux_led
41+
python -m pip install pytest .[test] -r requirements.txt -r requirements_test.txt
3542
- name: Test with pytest
3643
run: |
3744
pytest --cov=flux_led --cov-report term-missing --cov-report xml -- tests

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,25 @@ repos:
5757
# rev: v2.3.0
5858
# hooks:
5959
# - id: codespell
60+
- repo: https://github.com/pre-commit/mirrors-mypy.git
61+
rev: v1.15.0
62+
hooks:
63+
- id: mypy
64+
alias: mypy-py313
65+
name: MyPy, for Python 3.13
66+
additional_dependencies:
67+
- pytest
68+
- webcolors
69+
args:
70+
- --python-version=3.13
71+
files: ^(flux_led)/.+\.py$
72+
- id: mypy
73+
alias: mypy-py39
74+
name: MyPy, for Python 3.9
75+
additional_dependencies:
76+
- async_timeout
77+
- pytest
78+
- webcolors
79+
args:
80+
- --python-version=3.9
81+
files: ^(flux_led)/.+\.py$

examples/crossfade_example.py

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

3-
"""Example to cycle a bulb between colors in a list, with a smooth fade between.
3+
"""
4+
Example to cycle a bulb between colors in a list, with a smooth fade between.
45
56
Assumes the bulb is already on.
67

examples/sun_timers_example.py

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

3-
"""This is an example script that can be used to set on and off timers based on the sunrise/sunset times.
3+
"""
4+
This is an example script that can be used to set on and off timers based on the sunrise/sunset times.
45
56
Specifically, it will set times on an outside porch light
67
to turn on at dusk and off at dawn. It will set the timers for

0 commit comments

Comments
 (0)