python-rapidjson icon indicating copy to clipboard operation
python-rapidjson copied to clipboard

another typing correction: Missing positional argument "stream" in call to "__call__" of "Encoder"

Open brianmedigate opened this issue 1 year ago • 3 comments

It looks like the type hint for Encoder.__call__() is missing the default value for the stream parameter. Mypy warns that I didn't pass the argument, but in practice it doesn't seem to be required.

I am using version 1.20.

brianmedigate avatar Aug 31 '24 19:08 brianmedigate

Thank you, I will check.

lelit avatar Sep 01 '24 05:09 lelit

Can you try out referenced commit and confirm it fixes the problem? I wonder if there is a recommended way to build a test suite against typing stubs, any suggestion?

lelit avatar Sep 01 '24 06:09 lelit

yeah looks good, thanks!

hmm good question, I'm not sure I'm an expert there.

I would start by checking out stubtest: https://mypy.readthedocs.io/en/stable/stubtest.html, which should work for extension modules if they export their signatures correctly.

Another approach that might work is the crowdsourced one: take representative open source projects which use python-rapidjson and are well typed, and run mypy on them with new versions of the package to see if anything breaks.

brianmedigate avatar Sep 01 '24 06:09 brianmedigate