Skip to content

ci(python): type checking with pyright#3286

Merged
wjones127 merged 2 commits into
lance-format:mainfrom
wjones127:ci/python-type-check
Dec 24, 2024
Merged

ci(python): type checking with pyright#3286
wjones127 merged 2 commits into
lance-format:mainfrom
wjones127:ci/python-type-check

Conversation

@wjones127

Copy link
Copy Markdown
Contributor

Initial step of #3285

@github-actions github-actions Bot added A-python Python bindings ci Github Action or Test issues labels Dec 23, 2024
Comment thread python/pyproject.toml
Comment on lines -71 to -75
[tool.mypy]
python_version = "3.12"
check_untyped_defs = true
warn_redundant_casts = true
warn_unused_ignores = true

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.

We don't use mypy. I chose pyright over mypy because it's generally faster. But if anyone has a strong opinion otherwise, I'm happy to hear them out.

Comment on lines -119 to +120
if has_fixed_shape_tensor:
# Pyarrow compatibility
shape = (ret.type.list_size,)
tensor_type = pa.fixed_shape_tensor(ret.type.value_type, shape)
ret = pa.FixedShapeTensorArray.from_storage(tensor_type, ret)

shape = (ret.type.list_size,)
tensor_type = pa.fixed_shape_tensor(ret.type.value_type, shape)
ret = pa.FixedShapeTensorArray.from_storage(tensor_type, ret)

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.

PyArrow introducted FixedShapeTensor in 13.0.0, and our minimum pyarrow is now 14.0.0. So don't need to handle older versions now.

@wjones127
wjones127 marked this pull request as ready for review December 23, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-python Python bindings ci Github Action or Test issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants