Skip to content

fix: add support for Python 3.14 - #196

Merged
oberstet merged 1 commit into
crossbario:masterfrom
Jenselme:python314
Sep 23, 2025
Merged

fix: add support for Python 3.14#196
oberstet merged 1 commit into
crossbario:masterfrom
Jenselme:python314

Conversation

@Jenselme

@Jenselme Jenselme commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Description


Related Issue(s)

Closes or relates to #193


Checklist

  • I have referenced relevant issue numbers above
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that
    my feature works
  • I have added necessary documentation (if appropriate)
  • My code follows the style guidelines of this project

AI Assistance Disclosure

Created the relevant file in .audit.

Review of the proposed Python 3.14 compatibility fix

Reviewed by: GitHub Copilot (on behalf of @oberstet) See #193 (comment) for the original comment.

The patch (commit) correctly addresses Python 3.14 compatibility by adding a fallback when asyncio.get_event_loop() raises a RuntimeError. If no event loop is running, it creates a new one and sets it. This pattern is now used in both the test utility code and in txaio/aio.py.

This approach is:

  • Consistent with recommendations from Python’s documentation for event loop management in 3.14+.
  • Minimal and targeted (affects only relevant code).
  • Backwards compatible with CPython 3.10 and earlier, and also works on PyPy, since the code first tries the legacy method and only falls back if needed.

Summary:
This fix is a robust way to support Python 3.14 and maintain compatibility with older Python versions.

@Jenselme

Jenselme commented Sep 3, 2025

Copy link
Copy Markdown
Contributor Author

I have run the test locally with tox and it passes on Python 3.10, 3.12 and 3.14. I guess it’s failing on Ubuntu because until 3.14 is released, it’s 3.14-dev and not 3.14 that should be used. Should I enable with the -dev suffix or just wait for 3.14 to be released?

@oberstet

oberstet commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

just some comments from my side, actually, I want to move everything (txaio, autobahn-python, crossbar, ..) to uv: crossbario/autobahn-python#1665 - so this would mean latest cpython is 3.14.0b3:

oberstet@amd-ryzen5:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.2 LTS
Release:        24.04
Codename:       noble
oberstet@amd-ryzen5:~$ which uv
/home/oberstet/.local/bin/uv
oberstet@amd-ryzen5:~$ uv --version
uv 0.7.19
oberstet@amd-ryzen5:~$ uv python list
cpython-3.14.0b3-linux-x86_64-gnu                 <download available>
cpython-3.14.0b3+freethreaded-linux-x86_64-gnu    <download available>
cpython-3.13.5-linux-x86_64-gnu                   .local/share/uv/python/cpython-3.13.5-linux-x86_64-gnu/bin/python3.13
cpython-3.13.5+freethreaded-linux-x86_64-gnu      <download available>
cpython-3.12.11-linux-x86_64-gnu                  .local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/bin/python3.12
cpython-3.12.3-linux-x86_64-gnu                   /usr/bin/python3.12
cpython-3.12.3-linux-x86_64-gnu                   /usr/bin/python3 -> python3.12
cpython-3.11.13-linux-x86_64-gnu                  .local/share/uv/python/cpython-3.11.13-linux-x86_64-gnu/bin/python3.11
cpython-3.10.18-linux-x86_64-gnu                  .local/share/uv/python/cpython-3.10.18-linux-x86_64-gnu/bin/python3.10
cpython-3.9.23-linux-x86_64-gnu                   <download available>
cpython-3.8.20-linux-x86_64-gnu                   <download available>
pypy-3.11.11-linux-x86_64-gnu                     .local/share/uv/python/pypy-3.11.11-linux-x86_64-gnu/bin/pypy3.11
pypy-3.10.16-linux-x86_64-gnu                     .local/share/uv/python/pypy-3.10.16-linux-x86_64-gnu/bin/pypy3.10
pypy-3.9.19-linux-x86_64-gnu                      <download available>
pypy-3.8.16-linux-x86_64-gnu                      <download available>
graalpy-3.11.0-linux-x86_64-gnu                   <download available>
graalpy-3.10.0-linux-x86_64-gnu                   <download available>
graalpy-3.8.5-linux-x86_64-gnu                    <download available>
oberstet@amd-ryzen5:~$ 

I have migrated my private Python project/repos already, but still didn't had time yet to get to txaio etc, even though crossbario/autobahn-python#1669 already is (mostly) just/uv.

in general, ideally, I would like best not care at all what OS distro CPython or PyPy packages are there. now, this hits a wall for me since I am doing stuff with KiCad and the CPython (cpyext) API, and I don't want to deal with building that from source, want to use PTH files, which works - if I use the same uv Python version as the OS one. which is 3.12. but that's not an issue for txaio or autobahn-python ..

louisfonoage64-collab

This comment was marked as spam.

@oberstet
oberstet merged commit d85785d into crossbario:master Sep 23, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants