For example:
# pkg/__init__.py
spam: str = "ham"
ham: int = 42
# pkg-stubs/__init__.pyi
ham: int
Running typestats check pkg-stubs (or typestats report pkg-stubs) will report 50% coverage, because spam is missing in the stubs, and type-checkers will therefore not know that it's there (because they'll only look at the .pyi here, following the typing spec, so the annotation of spam in the .py will not be "seen").
Will pyrefly report report 100% or 50% coverage?
I.e., does pyrefly report combines the symbol tree of both pkg and pkg- packages, or does it only index the .pyi?
I realize this is a bit paradoxical, because type-checkers ignore a .py if there's also a corresponding .pyi.
But we're measuring type coverage, so we can't assume that a .pyi is always complete.
Relevant typestats docs: https://jorenham.github.io/typestats/reference/implementation/#stubs-overlay-merge
Assuming that pyrefly currently doesn't do this, we could also do this manually in typestats by running pyrefly report on both pkg and pkg-stubs. But I can imagine that this combined approach can be useful outside of typestats too.
For example:
Running
typestats check pkg-stubs(ortypestats report pkg-stubs) will report 50% coverage, becausespamis missing in the stubs, and type-checkers will therefore not know that it's there (because they'll only look at the.pyihere, following the typing spec, so the annotation ofspamin the.pywill not be "seen").Will
pyrefly reportreport 100% or 50% coverage?I.e., does
pyrefly reportcombines the symbol tree of bothpkgandpkg-packages, or does it only index the.pyi?I realize this is a bit paradoxical, because type-checkers ignore a
.pyif there's also a corresponding.pyi.But we're measuring type coverage, so we can't assume that a
.pyiis always complete.Relevant typestats docs: https://jorenham.github.io/typestats/reference/implementation/#stubs-overlay-merge
Assuming that pyrefly currently doesn't do this, we could also do this manually in typestats by running
pyrefly reporton bothpkgandpkg-stubs. But I can imagine that this combined approach can be useful outside of typestats too.