Skip to content

Commit d7dc0ba

Browse files
svlandegpatrick91
andauthored
👷 Add ty to precommit (fastapilabs#167)
* add ty to precommit * fixes * add ignore * exclude tests/assets for ty as well * add three more ignores --------- Co-authored-by: Patrick Arminio <patrick.arminio@gmail.com>
1 parent c725a6a commit d7dc0ba

File tree

6 files changed

+44
-6
lines changed

6 files changed

+44
-6
lines changed

‎.pre-commit-config.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,10 @@ repos:
3333
require_serial: true
3434
language: unsupported
3535
pass_filenames: false
36+
37+
- id: local-ty
38+
name: ty check
39+
entry: uv run ty check src tests
40+
require_serial: true
41+
language: unsupported
42+
pass_filenames: false

‎pyproject.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ dev = [
5252
"ruff==0.13.0",
5353
"respx==0.22.0",
5454
"time-machine==2.15.0",
55+
"ty>=0.0.9",
5556
]
5657

5758
[project.urls]
@@ -103,6 +104,9 @@ show_contexts = true
103104
strict = true
104105
exclude = ["tests/assets/*"]
105106

107+
[tool.ty.src]
108+
exclude = ["tests/assets/**"]
109+
106110
[tool.ruff.lint]
107111
select = [
108112
"E", # pycodestyle errors

‎scripts/lint.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ set -e
44
set -x
55

66
mypy src tests
7+
ty check src tests
78
ruff check src tests scripts
89
ruff format src tests --check

‎src/fastapi_cloud_cli/commands/deploy.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ def _wait_for_deployment(
478478
time_elapsed = time.monotonic() - started_at
479479

480480
if log.type == "message":
481-
progress.log(Text.from_ansi(log.message.rstrip()))
481+
progress.log(Text.from_ansi(log.message.rstrip())) # ty: ignore[unresolved-attribute]
482482

483483
if log.type == "complete":
484484
build_complete = True
@@ -581,13 +581,13 @@ def _waitlist_form(toolkit: RichToolkit) -> None:
581581
)
582582
form.add_input("secret_code", label="Secret code", placeholder="123456")
583583

584-
result = form.run() # type: ignore
584+
result = form.run() # type: ignore # ty: ignore[unused-ignore-comment]
585585

586586
try:
587587
result = SignupToWaitingList.model_validate(
588588
{
589589
"email": email,
590-
**result, # type: ignore
590+
**result, # type: ignore # ty: ignore[unused-ignore-comment]
591591
},
592592
)
593593
except ValidationError:

‎tests/test_api_client.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def test_stream_build_logs_successful(
5555
assert len(logs) == 3
5656

5757
assert logs[0].type == "message"
58-
assert logs[0].message == "Building..."
58+
assert logs[0].message == "Building..." # ty: ignore[unresolved-attribute]
5959

6060
assert logs[1].type == "message"
61-
assert logs[1].message == "Done!"
61+
assert logs[1].message == "Done!" # ty: ignore[unresolved-attribute]
6262

6363
assert logs[2].type == "complete"
6464

@@ -201,7 +201,7 @@ def test_stream_build_logs_network_error_retry(
201201

202202
assert len(logs) == 2
203203
assert logs[0].type == "message"
204-
assert logs[0].message == "Success after retry"
204+
assert logs[0].message == "Success after retry" # ty: ignore[unresolved-attribute]
205205

206206

207207
def test_stream_build_logs_server_error_retry(

‎uv.lock‎

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

0 commit comments

Comments
 (0)