Skip to content

ci(python): typecheck arrow.py and test_arrow.py#7265

Open
YuangGao wants to merge 2 commits into
lance-format:mainfrom
YuangGao:ci/typecheck-arrow
Open

ci(python): typecheck arrow.py and test_arrow.py#7265
YuangGao wants to merge 2 commits into
lance-format:mainfrom
YuangGao:ci/typecheck-arrow

Conversation

@YuangGao

@YuangGao YuangGao commented Jun 13, 2026

Copy link
Copy Markdown

Summary

Add lance/arrow.py and tests/test_arrow.py to the pyright include list and fix the resulting type errors. Closes #3292.

  • arrow.py: narrow union types via typed locals / typing.cast, annotate the internal decoder return types, switch the fallback to pyarrow.compute as pc, and add a single # pyright: ignore[reportOptionalCall] for tf.stack (typed as None by tensorflow's incomplete stubs).
  • lance/lance/init.pyi: fix the bfloat16_array stub signature from List[str | None] to Sequence[float | None] — the Rust function takes Vec<Option<f32>>, and Sequence (covariant) lets list[float] callers type-check.
  • test_arrow.py: add import lance.arrow so the lance.arrow.* attribute accesses resolve.

Test plan

tensorflow is linux-only in pyproject.toml, so it was installed locally to mirror the CI (Linux) lint environment before checking.

  • pyright0 errors (15 warnings, all pre-existing missing-stub warnings for pyarrow/pandas/etc.)
  • ruff format --check + ruff check → pass
  • pytest python/tests/test_arrow.py20 passed

@github-actions github-actions Bot added A-python Python bindings A-deps Dependency updates ci Github Action or Test issues labels Jun 13, 2026
@YuangGao YuangGao marked this pull request as ready for review June 13, 2026 19:15

@wjones127 wjones127 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.

Looks nicely written. There are a few failures, but once those are addressed I'll be able to approve.

@YuangGao

Copy link
Copy Markdown
Author

@wjones127 Thanks! pushed a fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-deps Dependency updates A-python Python bindings ci Github Action or Test issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typecheck lance/arrow.py and tests/test_arrow.py

2 participants