Skip to content

Commit 6b5c076

Browse files
authored
Merge pull request #131 from hugovk/add-types
Add type hints to release.py and run mypy on CI
2 parents 9e4e51c + 75096fa commit 6b5c076

File tree

7 files changed

+199
-105
lines changed

7 files changed

+199
-105
lines changed

.github/workflows/lint.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v4
17-
- uses: actions/setup-python@v5.1.0
17+
- uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.x"
2020
cache: pip
2121
- uses: pre-commit/[email protected]
2222

23+
- name: Install dependencies
24+
run: |
25+
python3 -m pip install -U pip
26+
python3 -m pip install -U tox
27+
28+
- name: Mypy
29+
run: tox -e mypy
30+
2331
- name: Run PSScriptAnalyzer on PowerShell scripts
2432
shell: pwsh
2533
run: |

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
cache: pip
1818
cache-dependency-path: dev-requirements.txt
1919
- run: |
20-
python -m pip install -r dev-requirements.txt
20+
python -m pip install tox
2121
- run: |
22-
pytest tests/ --cov . --cov tests --cov-report term --cov-report xml
22+
tox -e py
2323
2424
- name: Upload coverage
2525
uses: codecov/[email protected]

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ repos:
3535
hooks:
3636
- id: actionlint
3737

38+
- repo: https://github.com/tox-dev/pyproject-fmt
39+
rev: 2.1.3
40+
hooks:
41+
- id: pyproject-fmt
42+
43+
- repo: https://github.com/abravalheri/validate-pyproject
44+
rev: v0.18
45+
hooks:
46+
- id: validate-pyproject
47+
48+
- repo: https://github.com/tox-dev/tox-ini-fmt
49+
rev: 1.3.1
50+
hooks:
51+
- id: tox-ini-fmt
52+
3853
- repo: meta
3954
hooks:
4055
- id: check-hooks-apply

mypy-requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mypy==1.10
2+
pytest
3+
pytest-mock

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tool.mypy]
2+
python_version = "3.12"
3+
pretty = true
4+
strict = true
5+
6+
# Extra checks that aren't included in --strict
7+
enable_error_code = "ignore-without-code,redundant-expr,truthy-iterable"
8+
extra_checks = true
9+
warn_unreachable = true
10+
11+
exclude = [
12+
"^add-to-pydotorg.py$",
13+
"^buildbotapi.py$",
14+
"^run_release.py$",
15+
"^sbom.py$",
16+
"^tests/test_release_tag.py$",
17+
"^tests/test_sbom.py$",
18+
"^windows-release/purge.py$",
19+
]

0 commit comments

Comments
 (0)