Skip to content

Commit 9dca23c

Browse files
chore(typing): add ty type checker to CI with baseline exclusions (#7938)
chore(typing): add ty type checker to CI with baseline exclusions (#7927) Add ty type checker integration with baseline exclusions for incremental adoption: - Add ty check step to quality_check workflow (runs on all Python versions like mypy) - Configure ty exclusions for 14 modules with existing diagnostics - Fix Makefile ty target indentation Co-authored-by: Leandro Damascena <lcdama@amazon.pt>
1 parent 7b93028 commit 9dca23c

File tree

4 files changed

+71
-13
lines changed

4 files changed

+71
-13
lines changed

.github/workflows/quality_check.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ name: Quality check - check code
1414
#
1515
# Always triggered on new PRs, PR changes and PR merge.
1616

17-
1817
on:
1918
pull_request:
2019
paths:
@@ -46,13 +45,13 @@ jobs:
4645
strategy:
4746
max-parallel: 5
4847
matrix:
49-
python-version: ["3.10","3.11","3.12","3.13","3.14"]
48+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
5049
env:
5150
PYTHON: "${{ matrix.python-version }}"
5251
permissions:
53-
contents: read # checkout code only
52+
contents: read # checkout code only
5453
steps:
55-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
54+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
5655
- name: Install poetry
5756
run: pipx install poetry
5857
- name: Set up Python ${{ matrix.python-version }}
@@ -65,8 +64,10 @@ jobs:
6564
run: make format-check
6665
- name: Formatting and Linting
6766
run: make lint
68-
- name: Static type checking
67+
- name: Static type checking (mypy)
6968
run: make mypy
69+
- name: Static type checking (ty)
70+
run: make ty
7071
- name: Test with pytest
7172
run: make test
7273
- name: Test dependencies with Nox

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ changelog:
100100
mypy:
101101
poetry run mypy --pretty aws_lambda_powertools examples
102102

103+
ty:
104+
poetry run ty check .
103105

104106
dev-version-plugin:
105107
poetry self add git+https://github.com/monim67/poetry-bumpversion@348de6f247222e2953d649932426e63492e0a6bf

poetry.lock

Lines changed: 35 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ mkdocs-llmstxt = ">=0.2,<0.5"
129129
avro = "^1.12.0"
130130
protobuf = "^6.30.2"
131131
types-protobuf = "^6.30.2.20250516"
132+
ty = "^0.0.10"
132133

133134
[tool.coverage.run]
134135
source = ["aws_lambda_powertools"]
@@ -215,3 +216,30 @@ generate-setup-file = true
215216
[tool.poetry_bumpversion.file."aws_lambda_powertools/shared/version.py"]
216217
search = 'VERSION = "{current_version}"'
217218
replace = 'VERSION = "{new_version}"'
219+
220+
[tool.ty]
221+
# ty type checker configuration
222+
223+
[tool.ty.src]
224+
include = ["aws_lambda_powertools/**"]
225+
exclude = [
226+
"tests/**",
227+
"examples/**",
228+
"docs/**",
229+
# Baseline exclusions - modules with existing diagnostics (issue #7927)
230+
# These will be addressed incrementally in follow-up PRs
231+
"aws_lambda_powertools/logging/**",
232+
"aws_lambda_powertools/utilities/validation/**",
233+
"aws_lambda_powertools/shared/**",
234+
"aws_lambda_powertools/metrics/**",
235+
"aws_lambda_powertools/middleware_factory/**",
236+
"aws_lambda_powertools/utilities/streaming/**",
237+
"aws_lambda_powertools/utilities/parameters/**",
238+
"aws_lambda_powertools/utilities/parser/**",
239+
"aws_lambda_powertools/utilities/data_masking/**",
240+
"aws_lambda_powertools/tracing/**",
241+
"aws_lambda_powertools/utilities/data_classes/**",
242+
"aws_lambda_powertools/utilities/batch/**",
243+
"aws_lambda_powertools/utilities/idempotency/**",
244+
"aws_lambda_powertools/event_handler/**",
245+
]

0 commit comments

Comments
 (0)