Jedi doesn't work with MLReaders #352
Comments
CC @davidhalter I wonder, if you could take a look at this and let me know if you see any obvious culprit. I cannot say if that's annotation issue, which is missed by mypy, or a problem with Jedi. |
@zero323 If the first example (AttributeError) really happens with latest master, please report it, that's definitely a bug. I'm not really sure I understand the other stuff. Please explain precisely what completions you would want at a certain point and what is wrong. I have never worked with the pyspark API. |
Here you are davidhalter/jedi#1479. Should be fully reproducible with master HEAD. |
Thank you. In general structure goes through multiple levels of inheritance where
is mixed in into different objects
So I'd expect that Thanks again for your time. Much obliged. |
Hmmm, if I had to guess this might have to do with the classmethod. It doesn't have to be that, but the classmethod might cause trouble, because I'm pretty sure that's not tested. If you find a simple reproduction case (you can probably do that in one simple file with classmethods, that would be awesome! |
With your guidance I've been able to reduce this problem to davidhalter/jedi#1480. Behavior is slightly different, but looks similar enough to suspect common root cause. Thanks again @davidhalter! |
Resolved in Jedi with davidhalter/jedi@da2a55c |
It seems like there is some problem with Jedi compatibility. Some components seem to work pretty well. For example
DataFrame
without stubs:and with stubs:
So far so good. However, if take for example
LinearRegressionModel.load
things don't work so well. Without stubs provides no suggestionsbut one provided with stubs
don't make much sense. If model is fitted:
Model which is explicitly annotated works fine, so it seems like there is something in
MLReader
or one of the sub-classes that causes a failure.We already have data tests for this (as well as some test cases from apache/spark examples, and mypy seems to be fine with this.
Since
LinearRegression.fit
works fine (and some toy tests confirm that),Generics
are not sufficient to reproduce the problem. So it seems like type parameter is not processed correctly on the path:LinearRegressionModel(..., avaMLReadable[LinearRegressionModel], ...)
JavaMLReadable(MLReadable[R])
MLReadable(Generic[R])
load(cls, path: str) -> R
Tested with:
jedi==0.15.2
andjedi==0.16.0
(0c56aa4).pyspark-stubs==3.0.0.dev5
pyspark==3.0.0.dev0
(afe70b3)The text was updated successfully, but these errors were encountered: