Instagram / MonkeyType

A Python library that generates static type annotations by collecting runtime types
Other
4.74k stars 170 forks source link

`*args` and `**kwargs` are not captured in traces #307

Open NotWearingPants opened 1 year ago

NotWearingPants commented 1 year ago

The types of *args and **kwargs arguments are not added to traces:

__main__.py:

import foo
foo.func(1, 2, a=3, b=4)

foo.py:

def func(*args, **kwargs):
    return sum(args) + sum(kwargs.values())
$ rm ./monkeytype.sqlite3; pipenv run monkeytype run . && sqlite3 ./monkeytype.sqlite3 .dump
[...]
INSERT INTO monkeytype_call_traces VALUES('2023-09-15 10:21:16.983236','foo','func','{}','{"module": "builtins", "qualname": "int"}',NULL);
COMMIT;

See https://github.com/Instagram/MonkeyType/pull/304#discussion_r1313907548.

carljm commented 9 months ago

I think this wouldn't be too difficult to implement. I don't expect to have time to do the implementation, but will review a pull request for the feature.