Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type checking #993

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

fix: type checking #993

wants to merge 5 commits into from

Conversation

chenkovsky
Copy link
Contributor

Which issue does this PR close?

No

Rationale for this change

pyo3 native code has no python type, without type hint, it's error prone.

What changes are included in this PR?

  • pyi type definitions
  • fix several bugs found by type hint.

Are there any user-facing changes?

No

Copy link
Contributor

@kylebarron kylebarron left a comment

Choose a reason for hiding this comment

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

This is a massive amount of new code that will only serve to present additional overhead when developing. The internal API is not public. A decision was made in #750 to use Python wrapper classes as the method for public-facing type checking.

@chenkovsky
Copy link
Contributor Author

This is a massive amount of new code that will only serve to present additional overhead when developing. The internal API is not public. A decision was made in #750 to use Python wrapper classes as the method for public-facing type checking.

internal api type annotation is not for user of this library,it's useful for developer of this library. automated tools can be used to gurarantee code quality. i annotated the intetnal api,then i can easily find several bugs via pyright.

@kylebarron
Copy link
Contributor

There's no guarantee that those internal types will match the actual runtime types from Rust. So in effect this adds another layer of types that must be manually kept up to date on every PR. In that way, I don't see where the benefit comes in. We already have developer type checking on the Rust side.

@chenkovsky
Copy link
Contributor Author

There's no guarantee that those internal types will match the actual runtime types from Rust. So in effect this adds another layer of types that must be manually kept up to date on every PR. In that way, I don't see where the benefit comes in. We already have developer type checking on the Rust side.

ok. if you dont think its necessary, i will remove the annotation and only commit the bug fix.

@kylebarron
Copy link
Contributor

ok. if you dont think its necessary, i will remove the annotation and only commit the bug fix.

Let's let another developer chime in as well. This is just my opinion.

What are the bug fix(es)?

@@ -66,9 +66,10 @@ def __init__(self, table: df_internal.Table) -> None:
"""This constructor is not typically called by the end user."""
self.table = table

@property
Copy link
Contributor

Choose a reason for hiding this comment

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

This is changing the user-facing API, no?

Copy link
Contributor Author

@chenkovsky chenkovsky Jan 13, 2025

Choose a reason for hiding this comment

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

i checked the test,i think we should use @ property, but previously we didnt do wrapping somewhere, raw table is returned that's why test passed.

@chenkovsky
Copy link
Contributor Author

most bugs are wrapping or unwrapping missing,since we have wrap classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants