Skip to content

chore: introduce ty for type checking (non-blocking)#366

Merged
imbajin merged 4 commits into
apache:mainfrom
bitflicker64:feat/ty-type-checker
Jun 25, 2026
Merged

chore: introduce ty for type checking (non-blocking)#366
imbajin merged 4 commits into
apache:mainfrom
bitflicker64:feat/ty-type-checker

Conversation

@bitflicker64

Copy link
Copy Markdown
Contributor

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

Why non-blocking

ty runs on every PR and surfaces type errors in the CI log, but continue-on-error: true keeps the build green. Once errors are fixed incrementally (file by file in follow-up PRs), continue-on-error: true will be removed to enforce the check.

Scope

Covers hugegraph-llm/src and hugegraph-python-client/src only.
hugegraph-ml is deferred due to heavy optional deps (DGL, PyTorch).
graph-mcp will be added once the module is introduced.

- Add ty>=0.0.51 to dev dependencies
- Add [tool.ty.rules] placeholder in root pyproject.toml
- Remove dead [tool.mypy] block from hugegraph-llm/pyproject.toml
- Add ty check step to ruff.yml with continue-on-error: true

Errors are reported in CI but do not fail the build during ramp-up.
Scope: hugegraph-llm/src and hugegraph-python-client/src only.

Closes apache#364
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Jun 22, 2026
@github-actions github-actions Bot added the llm label Jun 22, 2026

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking: no. Summary: The new non-blocking ty check currently runs without the runtime extras needed by the checked packages. Evidence: after uv sync --extra dev, uv run ty check hugegraph-llm/src hugegraph-python-client/src reports 838 diagnostics starting with unresolved fastapi, pydantic, and dotenv.

Comment thread .github/workflows/ruff.yml
…type check

- uv sync --extra dev --extra llm --extra python-client so ty can resolve
  fastapi, pydantic, dotenv etc. when checking hugegraph-llm/src and
  hugegraph-python-client/src
- add ty>=0.0.51 to dev dependencies
imbajin
imbajin previously approved these changes Jun 23, 2026

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking: no. Summary: No obvious issues found in the current head. Evidence: git diff --check passed; uv sync --extra dev --extra llm --extra python-client succeeded; non-blocking ty check executed and reported existing diagnostics.

Follow-up: please keep reducing the reported ty diagnostics incrementally. This PR is fine as a non-blocking signal rollout, but the current ty output should not become permanent CI noise; the goal should be to eventually make it clean enough to enforce.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 23, 2026

@VGalaxies VGalaxies left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review summary

  • Blocking: yes
  • Summary: The Python 3.12 Ruff matrix job now installs hugegraph-llm, which excludes Python 3.12, so CI can fail before the non-blocking ty step runs.
  • Evidence:
    • git diff origin/main...HEAD
    • nl -ba .github/workflows/ruff.yml
    • nl -ba hugegraph-llm/pyproject.toml

Comment thread .github/workflows/ruff.yml Outdated
…3.12 dep conflict

hugegraph-llm requires Python >=3.10,<3.12, so running
'uv sync --extra dev --extra llm --extra python-client' on the
3.12 build matrix entry causes dep resolution failure before the
non-blocking ty step can apply.

Split into:
- build job (3.10/3.11/3.12): only ruff format+lint, uv sync --extra dev
- ty-check job (3.10/3.11 only): installs llm+client extras,
  runs ty check with continue-on-error: true at job level

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking: no. Summary: No obvious issues found in the current head. Evidence: git diff --check refs/remotes/apache/main...refs/remotes/pr/366 passed; latest-head GitHub checks completed successfully.

@imbajin imbajin changed the title feat(ci): introduce ty for type checking (non-blocking) chore: introduce ty for type checking (non-blocking) Jun 25, 2026
@imbajin imbajin merged commit 5ee21cc into apache:main Jun 25, 2026
20 checks passed
haohao0103 pushed a commit to haohao0103/incubator-hugegraph-ai that referenced this pull request Jun 30, 2026
Closes apache#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer llm size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Introduce ty for type checking: gradual, non-blocking adoption

3 participants