Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"recommendations": [
"ms-python.python",
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.vscode/settings.json still contains python.analysis.* settings (inlay hints), which are provided by Pylance. Since this change replaces the Pylance recommendation with astral-sh.ty, contributors may lose those editor features unless they manually install Pylance. Consider recommending both ms-python.vscode-pylance and astral-sh.ty, or remove the remaining python.analysis.* settings if the project is intentionally moving away from Pylance.

Suggested change
"ms-python.python",
"ms-python.python",
"ms-python.vscode-pylance",

Copilot uses AI. Check for mistakes.
"ms-python.vscode-pylance",
"astral-sh.ty",
"charliermarsh.ruff",
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig",
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.analysis.typeCheckingMode": "strict",
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.variableTypes": true,
"[python]": {
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fmt:
uv run ruff format .

lint:
uv run pyright src/expr_simplifier tests
uv run ty check --error-on-warning src/expr_simplifier tests
uv run ruff check .

fmt-docs:
Expand Down
11 changes: 2 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,12 @@ expr_simplifier = "expr_simplifier.__main__:main"

[dependency-groups]
dev = [
"pyright>=1.1.406",
"ty>=0.0.32",
"ruff>=0.14.0",
"pytest>=8.4.2",
"pytest-rerunfailures>=16.0.1",
]

[tool.pyright]
include = ["src/expr_simplifier", "tests"]
pythonVersion = "3.10"
typeCheckingMode = "strict"

[tool.ruff]
line-length = 120
target-version = "py310"
Expand All @@ -66,9 +61,7 @@ select = [
"RUF100",
]
ignore = [
"E501", # line too long, duplicate with ruff fmt
"F401", # imported but unused, duplicate with pyright
"F841", # local variable is assigned to but never used, duplicate with pyright
"E501", # line too long, duplicate with ruff format
]

[tool.ruff.lint.isort]
Expand Down
3 changes: 2 additions & 1 deletion src/expr_simplifier/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import ast
from collections.abc import Callable
from typing import Any

from expr_simplifier import __version__
from expr_simplifier.transforms import apply_constant_folding, apply_cse, apply_logical_simplification
Expand All @@ -24,7 +25,7 @@ def create_pass_parser(
name: str,
passes: list[Pass],
description: str,
subparser: argparse._SubParsersAction[argparse.ArgumentParser], # pyright: ignore [reportPrivateUsage]
subparser: Any,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 这个不能用某种方式保持类型吗?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改成保留类型信息的写法了,见 39da1f6。现在这里用一个只约束 add_parser(...) -> argparse.ArgumentParser 的 Protocol,避免退回 Any,也不再依赖 Pyright 的私有类型。

) -> None:
parser = subparser.add_parser(name, help=description)
parser.add_argument("input", help="The expression to simplify")
Expand Down
50 changes: 26 additions & 24 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading