On Thu, 15 Jul 2021 at 17:02, Richard van der Hoff <richard@matrix.org> wrote:
On 11/07/2021 00:49, Glyph wrote:
Thank you Adi!  Very glad to see us collectively getting back on the release-management horse again!  And it was super encouraging to see how quickly you were able to get this out, with all the automation that everyone (not least of all yourself) has been building to make this process faster and simpler.

To echo this: thank you for your work, Adi!

It appears we've buried the lede on one of our biggest features in this release though - https://github.com/twisted/twisted/pull/1448/files had no newsfile that shows up in the changelog, but it properly made Deferred into a generic, so I think this is the first release of Twisted where you might reasonably be able to use mypy without your own custom stub files! :)

This looks very cool, but presents us with a problem.

mypy now complains about instantiations of Deferred without a type annotation:

> d = defer.Deferred()

results in an error:

> synapse/util/async_helpers.py:124: error: Need type annotation for 'd'  [var-annotated]

We can't just go and add type annotations because we need to maintain compatibility with older Twisted (to make it possible to package in Debian et al).

Any suggestions for keeping mypy happy?

I also don't have much experience with mypy, but I guess that you can ignore the errors from twisted.internet.defer via mypy.ini

allow_untyped_defs = True

Adi Roiban