`DeprecationWarning` for Python 3.14: `Custom EventLoopPolicy`
Describe the bug
A DeprecationWarning for Python 3.14 is currently being encountered with usage of Toga through briefcase run.
Steps to reproduce
- Run
briefcase runwith Toga 0.5.1 installed. - The following warning is displayed:
beeware-tutorial/helloworld/build/helloworld/macos/app/Hello World.app/Contents/Resources/
app_packages/toga_cocoa/app.py:108: DeprecationWarning: Custom EventLoopPolicy instances
have been deprecated by Python 3.14. Create and use a `RubiconEventLoop` instance directly
instead of installing an event loop policy and calling `asyncio.new_event_loop()`.
asyncio.set_event_loop_policy(EventLoopPolicy())
Expected behavior
Toga update is needed to resolve this.
Screenshots
No response
Environment
- Operating System: MacOS
- Python version: Python 3.13
- Software versions:
- Briefcase: 0.3.23
- Toga: 0.5.1
Logs
Additional context
No response
Thanks for the report. This has been triggered by the release of Rubicon ObjC 0.5.1; the fix is that Toga needs to do exactly what the warning advises.
There's likely an analogous change to be made for the GTK backend (cc @danyeaw), as it currently constructs a GLibEventLoopPolicy(). I don't know if that will need a fix upstream in PyGObject, but something will be needed to maintain Py3.14 support without warnings.
Fixed in #3532
https://github.com/beeware/toga/pull/3532 only fixes this for macOS and iOS, so I'll rename the issue to indicate that it only applies to GTK.
Thanks for tagging me on this, I've opened https://gitlab.gnome.org/GNOME/pygobject/-/issues/697 to track fixing this in PyGObject.
I think this might affect Windows as well. The fix there will be entirely on the Toga side (as we're the one providing the Proactor event loop) - but we won't be able to test/evaluate this until Python.net supports 3.14.