Skip to content

ci: run mypy --strict in CI and pin the typing toolchain - #5283

Merged
yanghua merged 1 commit into
lance-format:mainfrom
jonasdedden:typing/tooling
Aug 26, 2026
Merged

ci: run mypy --strict in CI and pin the typing toolchain#5283
yanghua merged 1 commit into
lance-format:mainfrom
jonasdedden:typing/tooling

Conversation

@jonasdedden

Copy link
Copy Markdown
Contributor

Adds the [tool.mypy] configuration, the stub packages needed to type the third-party surface, a typecheck CI job and a make typecheck target.

Notes for review:

  • python_version is deliberately unset so it follows the interpreter mypy runs under. Pinning it to 3.10 makes mypy reject numpy 2.5's bundled stubs (type statements need >= 3.12); under a real 3.10 install numpy resolves to 2.2 and the run is clean. Verified clean on 3.10, 3.11, 3.12 and 3.13.
  • Rather than an error-code ignore list that silently decays, the four overrides are scoped to a named upstream cause. untyped_calls_exclude and implicit_reexport exist because ray/lance ship py.typed but still have unannotated public functions and undeclared re-exports.
  • uv.lock is refreshed for pyarrow-stubs (20260625 -> 20260819), pylance (10.0.0b7 -> 10.0.0) and ray (2.53.0 -> 2.55.0). The annotations merged in chore(typing): annotate field_path, utils, pandas and compaction #5270-test: annotate the vector index option suite #5279 were written against these; on the previously locked versions mypy reports 13 errors that are purely upstream typing gaps. ray is held at 2.55.0 on purpose: 2.56.0 switched Dataset.to_pandas() to Arrow-backed dtypes, which fails two assertions in tests/test_basic_read_write.py and deserves its own PR.

Adds the [tool.mypy] configuration, the stub packages needed to type the
third-party surface, a `typecheck` CI job and a `make typecheck` target.

Notes for review:

- `python_version` is deliberately unset so it follows the interpreter mypy
  runs under. Pinning it to 3.10 makes mypy reject numpy 2.5's bundled stubs
  (`type` statements need >= 3.12); under a real 3.10 install numpy resolves
  to 2.2 and the run is clean. Verified clean on 3.10, 3.11, 3.12 and 3.13.
- Rather than an error-code ignore list that silently decays, the four
  overrides are scoped to a named upstream cause. `untyped_calls_exclude`
  and `implicit_reexport` exist because ray/lance ship py.typed but still
  have unannotated public functions and undeclared re-exports.
- uv.lock is refreshed for pyarrow-stubs (20260625 -> 20260819), pylance
  (10.0.0b7 -> 10.0.0) and ray (2.53.0 -> 2.55.0). The annotations merged in
  lance-format#5270-lance-format#5279 were written against these; on the previously locked versions
  mypy reports 13 errors that are purely upstream typing gaps. ray is held
  at 2.55.0 on purpose: 2.56.0 switched `Dataset.to_pandas()` to
  Arrow-backed dtypes, which fails two assertions in
  tests/test_basic_read_write.py and deserves its own PR.
@jonasdedden

Copy link
Copy Markdown
Contributor Author

Btw., ray compat to 2.56 fixed in #5284

@yanghua yanghua left a comment

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.

LGTM

@yanghua
yanghua merged commit 986a778 into lance-format:main Aug 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants