Michael Niklas

Results 183 comments of Michael Niklas
trafficstars

I could add some return type annotations, but I doubt that mypy can work with the signature hacks and will always use *args, **kwargs. Any thoughts?

The 2D plotfunctions have the correct annotions at runtime (`plotfunc.__annotations__`) but mypy thinks they are *args, **kwargs. Same with the accessor methods. Does anyone have an idea how to tell...

Finally it is a much larger PR than initially expected. Turns out that the `col` and `row` arguments have to be overloaded since they return a `FacetGrid` instead of a...

Wow, to fix the overloads I had to copy-paste the complete function signature for each overload and again for the accessor methods. This leads to a massive overhead which I...

Ok found another interesting problem: the e.g. `functools.wraps(imshow)` in the PlotAccessor works because in the moment it is called, there is no class method named "imshow", so it will use...

> Maybe there's something to learn from how pandas does it: https://github.com/pandas-dev/pandas/tree/main/pandas/plotting ? Just had a quick look and I think their typing of the accessor is wrong, haha. They...

For now I see two options: 1. Move the accessor to its own module. For the user nothing should change since nobody should use the accessor directly anyway. 2. Create...

I have tried to solve it with ParamSpec and writing a custom wraps decorator, but it did not work, presumably due to https://github.com/python/mypy/issues/13540

Finally I am happy with the changes, the signatures are correct at runtime and static type checking time. I was finally: 1. renaming the `xarray.plot.plot` module to `xarray.plot.dataarray_plot` since it...

> One point aside — when this is done, we may be able to turn on mypy's strict mode, at least for the `tests` path, so then tests always need...