Here's a project I have
foo/__init__.py
from foo._something_private import bar
__all__ = ['bar']
foo/_something_private.py
def bar(a) -> None:
return None
So, foo._something_private.bar is defined in a private file, but it's re-exported in a public place (foo/__init__.py).
And indeed, pyrefly coverage check foo --public-only correctly checks foo._something_private.bar
$ pyrefly coverage check foo --public-only
WARN `foo._something_private.bar` is not fully typed [coverage-partial]
--> foo/_something_private.py:1:1
|
1 | / def bar(a) -> None:
2 | | return None
| |_______________-
|
ERROR type coverage 50.00% (1 of 2 typable) is below the 100.00% threshold
But, here's the issue: if I use --project-excludes=foo/_something_private.py, then foo._something_private.bar gets excluded, even though it's re-exported in a public place:
$ pyrefly coverage check foo --public-only --project-excludes foo/_something_private.py
INFO type coverage 100.00% (0 of 0 typable)
I'd like to suggest one of the following as a solution:
--project-excludes doesn't exclude publicly re-exported symbols. I think I'd prefer this solution
- or,
pyrefly coverage report shows all the re-exported paths, so then I can parse these as a user as I wish
Note that pyright shows foo.bar as the path for this symbol:
{
"category": "function",
"name": "foo.bar",
"referenceCount": 1,
"isExported": true,
"isTypeKnown": false,
"isTypeAmbiguous": false,
Here's a project I have
foo/__init__.pyfoo/_something_private.pySo,
foo._something_private.baris defined in a private file, but it's re-exported in a public place (foo/__init__.py).And indeed,
pyrefly coverage check foo --public-onlycorrectly checksfoo._something_private.barBut, here's the issue: if I use
--project-excludes=foo/_something_private.py, thenfoo._something_private.bargets excluded, even though it's re-exported in a public place:I'd like to suggest one of the following as a solution:
--project-excludesdoesn't exclude publicly re-exported symbols. I think I'd prefer this solutionpyrefly coverage reportshows all the re-exported paths, so then I can parse these as a user as I wishNote that pyright shows
foo.baras the path for this symbol:{ "category": "function", "name": "foo.bar", "referenceCount": 1, "isExported": true, "isTypeKnown": false, "isTypeAmbiguous": false,