You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
question: how to type compatibility-only args / kwargs? #1168
I'm trying to use pyright --verifytypes to check which public methods are untyped, and a lot of the results come from kwargs and args.
There seem to be 3 cases for them:
they're undocumented, and just silently exist to allow for numpy-compatible code. For example: Series.std
they get passed down to a third-party function. For example: most plotting funtions
when they get passed to other pandas functions which have known args/kwargs. For example, the kwargs in Series.pct_change.
How should kwargs and args get typed in these cases? I'm thinking:
1., 2.: use Any
3.: make a Protocol with only the args/kwargs which can be accepted
I think if we can get these typed (even if just with Any) then pyright's verifytypes should become a lot more useful to identify missing parts of the public API surface
We've used *args: Any, **kwargs: Any, in various places, just not consistently. I'm fine if you want to introduce that.
In the cases where we know that the possible kwargs are limited (e.g., Series.pct_change(), it would be best to just replace kwargs with the possible keywords that could be used. But as a first pass, we could just let it be **kwargs: Any
Activity
Dr-Irv commentedon Mar 13, 2025
We've used
*args: Any, **kwargs: Any,in various places, just not consistently. I'm fine if you want to introduce that.In the cases where we know that the possible
kwargsare limited (e.g.,Series.pct_change(), it would be best to just replacekwargswith the possible keywords that could be used. But as a first pass, we could just let it be**kwargs: Anyrefactor: #1168 *args: Any and **kwargs: Any
refactor: pandas-dev#1168 *args: Any and **kwargs: Any
refactor: #1168 *args: Any and **kwargs: Any (#1406)
refactor: pandas-dev#1168 *args: Any and **kwargs: Any (pandas-dev#1406)