Skip to content

Commit 4bb6907

Browse files
committed
build: 🛠 Switch to pyright + basic project cleanup
1 parent 7ceb8ce commit 4bb6907

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

‎.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "LINT: Run ruff & mypy"
1+
name: "LINT: Run ruff & pyright"
22
on:
33
push:
44
pull_request:
@@ -17,7 +17,7 @@ jobs:
1717
run: |
1818
python -m pip install --upgrade poetry
1919
poetry install -E fastapi
20-
- name: Lint with ruff & mypy
20+
- name: Lint with ruff & pyright
2121
run: |
2222
poetry run ruff check pydantic_async_validation tests
23-
poetry run mypy pydantic_async_validation
23+
poetry run pyright pydantic_async_validation

‎.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.5.0
44
hooks:
55
- id: end-of-file-fixer
66
- id: check-added-large-files
77
- id: check-merge-conflict
88
- id: check-docstring-first
99
- id: debug-statements
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.0.291
11+
rev: v0.2.1
1212
hooks:
1313
- id: ruff
1414
args: [--fix, --exit-non-zero-on-fix]
1515
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
16-
rev: v1.3.2
16+
rev: v1.3.3
1717
hooks:
1818
- id: python-safety-dependencies-check
1919
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
20-
rev: v9.5.0
20+
rev: v9.11.0
2121
hooks:
2222
- id: commitlint
2323
stages: [commit-msg]

‎justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ test-all: (poetry "run" "tox")
3232

3333
ruff *args: (poetry "run" "ruff" "check" "pydantic_async_validation" "tests" args)
3434

35-
mypy *args: (poetry "run" "mypy" "pydantic_async_validation" args)
35+
pyright *args: (poetry "run" "pyright" "pydantic_async_validation" args)
3636

37-
lint: ruff mypy
37+
lint: ruff pyright
3838

3939
publish: (poetry "publish" "--build")

‎pydantic_async_validation/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ def prefix_errors(
182182
**error,
183183
'type': (
184184
PydanticCustomError(
185-
error['type'],
186-
cast(ErrorDetails, error)['msg'],
185+
error['type'], # type: ignore
186+
cast(ErrorDetails, error)['msg'], # type: ignore
187187
)
188188
if isinstance(error['type'], str)
189189
else error['type']
@@ -197,7 +197,7 @@ def prefix_errors(
197197
{
198198
# Original data is InitErrorDetails, all fine
199199
**error,
200-
'loc': (*prefix, *error['loc']),
200+
'loc': (*prefix, *error.get('loc', [])),
201201
},
202202
)
203203
for error

‎pyproject.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@ fastapi = ["fastapi"]
2020
pytest = ">=7.1.2,<9.0.0"
2121
pytest-cov = ">=3,<5"
2222
pytest-asyncio = ">=0.21.1,<0.24.0"
23-
mypy = ">=0.971,<2.0"
2423
tox = ">=3.26,<5.0"
2524
httpx = ">=0.24.1,<0.27.0"
26-
ruff = ">=0.0.284,<0.3.0"
25+
ruff = ">=0.2.0,<0.3.0"
26+
pyright = ">=1.1.350,<1.2"
2727

2828
[tool.ruff]
29-
select = ["F","E","W","C","I","N","UP","ANN","S","B","A","COM","C4","T20","PT","ARG","TD","RUF"]
3029
line-length = 115
3130
target-version = "py38"
32-
ignore = ["A001","A002","A003","ANN101","ANN102","ANN401","C901","N8","B008","F405","F821"]
3331
output-format = "grouped"
3432

35-
[tool.ruff.per-file-ignores]
33+
[tool.ruff.lint]
34+
select = ["F","E","W","C","I","N","UP","ANN","S","B","A","COM","C4","T20","PT","ARG","TD","RUF"]
35+
ignore = ["A001","A002","A003","ANN101","ANN102","ANN401","C901","N8","B008","F405","F821"]
36+
37+
[tool.ruff.lint.per-file-ignores]
3638
"__init__.py" = ["F401"]
3739
"conftest.py" = ["S101","ANN","F401"]
3840
"test_*.py" = ["S101","ANN","F401"]

0 commit comments

Comments
 (0)