Skip to content

Commit fd55c31

Browse files
committed
Migrate type checking from mypy to ty
1 parent 83a9cf4 commit fd55c31

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,5 @@ report.fail_under = 76
124124
html.show_contexts = true
125125
html.skip_covered = false
126126

127-
[tool.mypy]
128-
python_version = "3.12"
129-
show_error_codes = true
130-
strict = true
127+
[tool.ty]
128+
environment.python-version = "3.14"

src/sphinx_argparse_cli/_logic.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def parser(self) -> ArgumentParser:
120120
except HookError as hooked:
121121
self._parser = hooked.parser
122122
finally:
123-
ArgumentParser.parse_known_args = original_parse_known_args # type: ignore[method-assign]
123+
ArgumentParser.parse_known_args = original_parse_known_args
124124
else:
125125
self._parser = parser_creator()
126126

@@ -158,8 +158,7 @@ def _load_sub_parsers(
158158

159159
# If this parser has a subparser, recurse into it
160160
if parser._subparsers: # noqa: SLF001
161-
sub_sub_parser: _SubParsersAction[ArgumentParser]
162-
sub_sub_parser = parser._subparsers._group_actions[0] # type: ignore[assignment] # noqa: SLF001
161+
sub_sub_parser: _SubParsersAction[ArgumentParser] = parser._subparsers._group_actions[0] # type: ignore[assignment] # noqa: SLF001
163162
yield from self._load_sub_parsers(sub_sub_parser)
164163

165164
def load_sub_parsers(self) -> Iterator[tuple[list[str], str, ArgumentParser]]:

tox.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ commands = [
5353

5454
[env.type]
5555
description = "run type check on code base"
56-
deps = [ "mypy==1.19", "types-docutils>=0.22.3.20251115" ]
57-
commands = [ [ "mypy", "src", "tests", { replace = "posargs", extend = true } ] ]
56+
deps = [ "ty>=0.0.17" ]
57+
commands = [ [ "ty", "check", "--output-format", "concise", "--error-on-warning", "." ] ]
5858

5959
[env.dev]
6060
description = "generate a DEV environment"

0 commit comments

Comments
 (0)