trio icon indicating copy to clipboard operation
trio copied to clipboard

Create documentation page for typing

Open A5rocks opened this issue 1 year ago • 4 comments

I think there's sufficient nuances in trio's typing to merit a documentation page to point at. Off the top of my head:

  • that we don't support .spawn yet
  • minimum mypy version (maybe pyright version too?) because eg my currently open RaisesGroup types PR requires 1.14+ (at least that's my guess. I remember it doesn't work on 1.13.2 because of the self-types in init)
  • relationship with trio-typing (full replacement other than aforementioned not supporting .spawn)
  • how to allow nursery-like objects as a 3rd party (just use a protocol w/ the methods/attributes you want), as an alternative to the (closed) PR to export one

There's probably other stuff too, but mainly it would be useful as a link reply to anyone talking about trio-typing.

... do other people think this is a decent idea? Maybe my bullet points above are exhaustive in which case idk maybe we don't need a docs page.

A5rocks avatar Nov 21 '24 20:11 A5rocks

Seems useful, maybe also we might want to recommend some options to turn on. In particular Mypy's unused-awaitable error code, since in trio coroutine calls must always be awaited.

TeamSpen210 avatar Nov 21 '24 20:11 TeamSpen210

Extra thing: BaseExceptionGroup/ExceptionGroup dichotomy for subclasses (I think you need the relevant overloads for the BaseExceptionGroup subclass and multiple inheritance for ExceptionGroup? I haven't tried out the types yet)

A5rocks avatar Jan 21 '25 05:01 A5rocks

Extra thing: BaseExceptionGroup/ExceptionGroup dichotomy for subclasses (I think you need the relevant overloads for the BaseExceptionGroup subclass and multiple inheritance for ExceptionGroup? I haven't tried out the types yet)

RaisesGroup is perhaps a special case, but yeah I keep being surprised how nasty the typing for [Base]ExceptionGroup is

jakkdl avatar Jan 21 '25 12:01 jakkdl

Extra thing: BaseExceptionGroup/ExceptionGroup dichotomy for subclasses (I think you need the relevant overloads for the BaseExceptionGroup subclass and multiple inheritance for ExceptionGroup? I haven't tried out the types yet)

related typeshed issue https://github.com/python/typeshed/issues/9922

jakkdl avatar Jan 29 '25 11:01 jakkdl