Skip to content

Commit 5ee21cc

Browse files
authored
chore: introduce ty for type checking (non-blocking) (#366)
Closes #364 ## What Introduces `ty` (Astral's Rust-based type checker) to the project in non-blocking mode as the first step of a gradual adoption plan. ## Changes - **`pyproject.toml`** — add `ty>=0.0.51` to `dev` optional dependencies; add `[tool.ty.rules]` placeholder section - **`hugegraph-llm/pyproject.toml`** — remove the `[tool.mypy]` block (its three settings are either unsupported or default behavior in ty) - **`.github/workflows/ruff.yml`** — add `ty check` step with `continue-on-error: true` so errors are reported but do not fail CI during ramp-up
1 parent 5f4b54a commit 5ee21cc

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

.github/workflows/ruff.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,43 @@ jobs:
4949
- name: Lint code with Ruff
5050
run: |
5151
uv run ruff check .
52+
53+
ty-check:
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
python-version: ["3.10", "3.11"] # hugegraph-llm requires <3.12
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Setup Python ${{ matrix.python-version }}
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
67+
- name: Install uv
68+
run: |
69+
curl -LsSf https://astral.sh/uv/install.sh | sh
70+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
71+
72+
- name: Cache dependencies
73+
id: cache-deps
74+
uses: actions/cache@v4
75+
with:
76+
path: |
77+
~/.cache/uv
78+
~/.cache/pip
79+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
80+
restore-keys: |
81+
${{ runner.os }}-uv-${{ matrix.python-version }}-
82+
83+
- name: Install dev + runtime extras
84+
run: |
85+
uv sync --extra dev --extra llm --extra python-client
86+
87+
- name: Type check with ty (non-blocking)
88+
run: uv run ty check hugegraph-llm/src hugegraph-python-client/src
89+
continue-on-error: true
90+
# TODO: extend scope to hugegraph-ml once heavy optional deps (DGL, PyTorch) are handled
91+
# TODO: add graph-mcp once the module is introduced

hugegraph-llm/pyproject.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ allow-direct-references = true
100100
hugegraph-python-client = { workspace = true }
101101
pycgraph = { git = "https://github.com/ChunelFeng/CGraph.git", subdirectory = "python", tag = "v3.2.2", marker = "platform_machine == 'aarch64'" }
102102

103-
[tool.mypy]
104-
disable_error_code = ["import-untyped"]
105-
check_untyped_defs = true
106-
disallow_untyped_defs = false
107-
108103
[tool.ruff]
109104
line-length = 120
110105
indent-width = 4

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dev = [
4646
"pylint~=3.0.0",
4747
"ruff>=0.11.0",
4848
"mypy>=1.16.1",
49+
"ty>=0.0.51", # pre-stable (0.0.x): consider tight pinning to avoid surprise breakage
4950
"pre-commit>=3.5.0",
5051
]
5152

@@ -197,3 +198,6 @@ indent-style = "space"
197198
skip-magic-trailing-comma = false
198199
line-ending = "auto"
199200
docstring-code-format = true
201+
202+
[tool.ty.rules]
203+
# Start permissive; tighten incrementally as errors are fixed

0 commit comments

Comments
 (0)