Trio support for Cygwin under Windows 10/11

Greetings!

I installed trio using python3 under cygwin, but when I run a simple test program I get,

$ python3 triotest.py
Traceback (most recent call last):
  File "/home/E608313/p/python/triotest.py", line 2, in <module>
    import trio
  File "/home/E608313/.local/lib/python3.9/site-packages/trio/__init__.py", line 23, in <module>
    from ._core import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED  # isort: split
  File "/home/E608313/.local/lib/python3.9/site-packages/trio/_core/__init__.py", line 21, in <module>
    from ._local import RunVar, RunVarToken
  File "/home/E608313/.local/lib/python3.9/site-packages/trio/_core/_local.py", line 9, in <module>
    from . import _run
  File "/home/E608313/.local/lib/python3.9/site-packages/trio/_core/_run.py", line 2822, in <module>
    raise NotImplementedError("unsupported platform")
NotImplementedError: unsupported platform

Is there an easy way for trio to support Cygwin? I made the first change, and then another error popped up. So, I raise the question to see if anyone can provide an answer. Thanks.

josé

Is there an easy way for trio to support Cygwin?

No, it would not be easy.

Deep down in Trio, ultimately it has to ask the operating system to wait until one of the currently active tasks is ready to resume, by telling the OS what they are all waiting for (sleep, read from socket, etc.).

Traditionally, you would use the select() or poll() OS calls for that. The good thing about these is that they’re supported on essentially all platforms, even Windows (at least to some extent). The downside is that they’re quite slow, especially if you’re waiting for many things at once. You can easily find more information about that problem on the web.

There are more modern alternatives that don’t have that downside, but the problem with those is that they’re more platform specific (epoll() on Linux,kqueue on Mac/BSD, IOCP on Windows).

The function raising this exception is choosing between those alternatives. It’s doing so because Cygwin does not support any of them.

If even you were prepared to accept the reduced performance of poll(), it would be a big job to add support for it because there’s a lot of support code needed to use any of these functions.

No, it would not be easy.

Thanks.