ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
5.28k stars 595 forks source link

question: types not working with pyright #6619

Closed masylum closed 1 year ago

masylum commented 1 year ago

What happened?

First of all, I'm pretty new to python and it's ecosystem, so this can very well be that "I'm holding it wrong".

I'm trying to use ibis for the expression to sql generation, but I'm stumbling upon very basic features. For instance, when using isin pyright complains that the types are not correct. They do not look correct to me either, so I'm wondering if this is a bug or not.

t = ibis.table([("one", "string")], "my_data")
t.one.isin(["a", "b"]) # pyright: Argument of type "list[str]" cannot be assigned to parameter "values" of type "Value | Sequence[Value]" in function "isin"    "Literal['a']" is incompatible with "Value"

The type of isin clearly says Value | Sequence[Value] but on every single example, it can be used against lists of strings.

Thanks in advance!

What version of ibis are you using?

5.1.0

What backend(s) are you using, if any?

postrgresql

Relevant log output

No response

Code of Conduct

cpcloud commented 1 year ago

Hi @masylum! Thanks for the issue.

Are you hitting a problem with ibis code generation or only type checking?

Our type annotations are currently best-effort, not for any reason other than there's never been a concerted effort to add them.

Are the imprecise type annotations a blocker for you?

lostmygithubaccount commented 1 year ago

going to close this out, @masylum let us know if you have additional information on the issue being caused here. we'll work to improve type annotation support where we can