Type checkers don't like non-literal `__all__` in `thinc.api` for exposing the public interface
willfrey opened this issue · 2 comments
willfrey commented
If you forbid implicit reexports in Mypy (or turn Pyright/Pylance on at all), the type checkers will complain about thinc.api
not exposing anything publicly. This is because the imports are of the form from name import target
and __all__
can only be inferred at runtime.
Would there be any objection to doing either of the following?
- Explicitly re-export names in
thinc.api
through imports of the formfrom namespace import target as target
. - Change
__all__
to be made up of string literals for each public member inthinc.api
.
The first option eliminates the need for a __all__
entirely, if you're concerned about having to repeat each public interface member three times.
If you're okay with either (or both), I'm happy to make the changes and open a PR.
Thank you!
svlandeg commented
Hi! Thanks for the report, we'll have a look how best to address this issue!
willfrey commented
Thanks!