Skip to content

Commit 4fa3875

Browse files
CopilotSigureMo
andauthored
🏷️ types: move to ty (#24)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
1 parent d9e1fed commit 4fa3875

6 files changed

Lines changed: 36 additions & 37 deletions

File tree

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"recommendations": [
33
"ms-python.python",
4-
"ms-python.vscode-pylance",
4+
"astral-sh.ty",
55
"charliermarsh.ruff",
66
"esbenp.prettier-vscode",
77
"EditorConfig.EditorConfig",

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
3-
"python.analysis.typeCheckingMode": "strict",
43
"python.analysis.inlayHints.functionReturnTypes": true,
54
"python.analysis.inlayHints.variableTypes": true,
65
"[python]": {

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fmt:
1111
uv run ruff format .
1212

1313
lint:
14-
uv run pyright src/expr_simplifier tests
14+
uv run ty check --error-on-warning src/expr_simplifier tests
1515
uv run ruff check .
1616

1717
fmt-docs:

pyproject.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,12 @@ expr_simplifier = "expr_simplifier.__main__:main"
3232

3333
[dependency-groups]
3434
dev = [
35-
"pyright>=1.1.406",
35+
"ty>=0.0.32",
3636
"ruff>=0.14.0",
3737
"pytest>=8.4.2",
3838
"pytest-rerunfailures>=16.0.1",
3939
]
4040

41-
[tool.pyright]
42-
include = ["src/expr_simplifier", "tests"]
43-
pythonVersion = "3.10"
44-
typeCheckingMode = "strict"
45-
4641
[tool.ruff]
4742
line-length = 120
4843
target-version = "py310"
@@ -66,9 +61,7 @@ select = [
6661
"RUF100",
6762
]
6863
ignore = [
69-
"E501", # line too long, duplicate with ruff fmt
70-
"F401", # imported but unused, duplicate with pyright
71-
"F841", # local variable is assigned to but never used, duplicate with pyright
64+
"E501", # line too long, duplicate with ruff format
7265
]
7366

7467
[tool.ruff.lint.isort]

src/expr_simplifier/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
import argparse
44
import ast
55
from collections.abc import Callable
6+
from typing import Any, Protocol
67

78
from expr_simplifier import __version__
89
from expr_simplifier.transforms import apply_constant_folding, apply_cse, apply_logical_simplification
910
from expr_simplifier.typing import Pass
1011
from expr_simplifier.utils import loop_until_stable
1112

1213

14+
class _SubparserFactory(Protocol):
15+
def add_parser(self, name: str, /, **kwargs: Any) -> argparse.ArgumentParser: ...
16+
17+
1318
def create_pass_command(name: str, passes: list[Pass]) -> Callable[[argparse.Namespace], None]:
1419
def pass_command(args: argparse.Namespace) -> None:
1520
expr = ast.parse(args.input, mode="eval")
@@ -24,7 +29,7 @@ def create_pass_parser(
2429
name: str,
2530
passes: list[Pass],
2631
description: str,
27-
subparser: argparse._SubParsersAction[argparse.ArgumentParser], # pyright: ignore [reportPrivateUsage]
32+
subparser: _SubparserFactory,
2833
) -> None:
2934
parser = subparser.add_parser(name, help=description)
3035
parser.add_argument("input", help="The expression to simplify")

uv.lock

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

0 commit comments

Comments
 (0)