I’ve been writing Trio-using code using static type annotations (PEP 484 / mypy / etc) for a few months, and have finally gotten around to packaging the Trio stubs I wrote with a mypy plugin that smooths over some pitfalls. You can get it on PyPI:
pip install trio-typing. It comes with stubs for
async_generator, a package
trio_typing from which you can import type names like
TaskStatus, and a mypy plugin
trio_typing.plugin. See https://github.com/python-trio/trio-typing/blob/master/README.rst for more details.
In the long run I suspect we’d like to have these integrated into Trio, but Trio is a little too dynamic for that to be an easy task at the moment, and I wanted to let other folks start building statically-typed Trio applications in the meantime. Feedback and experience reports would be much appreciated!
You’ll need trio v0.11.0 (released yesterday) or later, to support writing