matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
153 stars 139 forks source link

Bump python version #343

Closed dklimpel closed 11 months ago

dklimpel commented 11 months ago

Python 3.7 is EOL

Python 3.11 is also the Python version of Synapse in Dockerfile

Max Python version here: 3.10. The upgrade to Python 3.11 seems to need more dependency updates.

      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iast27/Include -I/home/runner/work/sygnal/sygnal/.tox/check_codestyle/include -I/opt/hostedtoolcache/Python/3.11.4/x64/include/python3.11 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-cpython-311/ast27/Custom/typed_ast.o
      In file included from ast27/Custom/typed_ast.c:3:
      ast27/Custom/../Include/compile.h:5:10: fatal error: code.h: No such file or directory
          5 | #include "code.h"
            |          ^~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1

Possible solutions / causes:

Related to:

bradtgmurray commented 10 months ago

I'm pretty sure this broke apns configurations, as we pinned back aioapns to an older version that didn't support Python 3.10 here: https://github.com/matrix-org/sygnal/issues/293

│ Error during startup:                                                                                                                                                                                                                                                                                                                                                  │
│ Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                     │
│   File "/usr/local/lib/python3.10/site-packages/sygnal/sygnal.py", line 228, in start                                                                                                                                                                                                                                                                                  │
│     yield ensureDeferred(self.make_pushkins_then_start())                                                                                                                                                                                                                                                                                                              │
│   File "/usr/local/lib/python3.10/site-packages/twisted/internet/defer.py", line 1374, in ensureDeferred                                                                                                                                                                                                                                                               │
│     return Deferred.fromCoroutine(coro)                                                                                                                                                                                                                                                                                                                                │
│   File "/usr/local/lib/python3.10/site-packages/twisted/internet/defer.py", line 1349, in fromCoroutine                                                                                                                                                                                                                                                                │
│     return _cancellableInlineCallbacks(coro)                                                                                                                                                                                                                                                                                                                           │
│   File "/usr/local/lib/python3.10/site-packages/twisted/internet/defer.py", line 2157, in _cancellableInlineCallbacks                                                                                                                                                                                                                                                  │
│     _inlineCallbacks(None, gen, status, _copy_context())                                                                                                                                                                                                                                                                                                               │
│ --- <exception caught here> ---                                                                                                                                                                                                                                                                                                                                        │
│   File "/usr/local/lib/python3.10/site-packages/sygnal/sygnal.py", line 228, in start                                                                                                                                                                                                                                                                                  │
│     yield ensureDeferred(self.make_pushkins_then_start())                                                                                                                                                                                                                                                                                                              │
│   File "/usr/local/lib/python3.10/site-packages/twisted/internet/defer.py", line 1997, in _inlineCallbacks                                                                                                                                                                                                                                                             │
│     result = context.run(gen.send, result)                                                                                                                                                                                                                                                                                                                             │
│   File "/usr/local/lib/python3.10/site-packages/sygnal/sygnal.py", line 200, in make_pushkins_then_start                                                                                                                                                                                                                                                               │
│     self.pushkins[app_id] = await self._make_pushkin(app_id, app_cfg)                                                                                                                                                                                                                                                                                                  │
│   File "/usr/local/lib/python3.10/site-packages/sygnal/sygnal.py", line 195, in _make_pushkin                                                                                                                                                                                                                                                                          │
│     return await clarse.create(app_name, self, app_config)                                                                                                                                                                                                                                                                                                             │
│   File "/usr/local/lib/python3.10/site-packages/sygnal/notifications.py", line 189, in create                                                                                                                                                                                                                                                                          │
│     return cls(name, sygnal, config)                                                                                                                                                                                                                                                                                                                                   │
│   File "/usr/local/lib/python3.10/site-packages/sygnal/apnspushkin.py", line 191, in __init__                                                                                                                                                                                                                                                                          │
│     self.apns_client = APNs(                                                                                                                                                                                                                                                                                                                                           │
│ builtins.TypeError: APNs.__init__() got an unexpected keyword argument 'loop'                                                                                                                                                                                                                                                                                          │

Do we do something like this other PR in a different project using aioapns to fix it? https://github.com/zulip/zulip/pull/21066/files