typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Code quality: Introduce and assert `incomplete` flag

Open srittau opened this issue 1 year ago • 4 comments

Part of #11769

This finds 25 more modules with unannotated items (due to Incomplete) than our current pyright stricter config.

srittau avatar May 20 '24 16:05 srittau

Currently, this script checks only third-party stubs. stdlib stubs would be a next step.

srittau avatar May 20 '24 16:05 srittau

I'd rather not include a large amount of untested AST-processing code in our CI scripts. Perhaps we could instead use pyright's library completeness score, or the similar logic from https://github.com/alexwaygood/typeshed-stats.

JelleZijlstra avatar Jun 01 '24 04:06 JelleZijlstra

May I suggest going for a config name less vague than incomplete ? Maybe incomplete_annotations ? fully_annotated ?

Since the concepts of completeness/partialness can mean different concrete things depending on the context: pyright (Unknown), mypy (un/annotated and incomplete defs), stubtest (check for missing symbols), stubs (partially typed), etc.

Avasam avatar Jun 01 '24 05:06 Avasam

typeshed-stats exposes a library interface as well as a CLI. It should be possible to have it as a test dependency here and use a small wrapper script to assert that 100% of parameters have annotations if there's some flag in METADATA.toml. It has 100% test coverage.

API documentation, with code examples, is here: https://alexwaygood.github.io/typeshed-stats/gather/

AlexWaygood avatar Jun 01 '24 09:06 AlexWaygood

Closing since there are many merge conflicts and there isn't agreement on the implementation

hauntsaninja avatar Dec 31 '24 00:12 hauntsaninja