id summary reporter owner description type status priority milestone component version resolution keywords cc 3207 Core: migrate from Twisted to Asyncio andar andar "We should migrate away from the use of Twisted within Deluge, starting with the Core. asyncio[0] is available as a standard library with the async/await keywords syntax as of Python 3.5. The move to asyncio will help simplify and modernize the code-base, and also allow us to remove a major dependency. There shouldn't be anything Twisted specific that we actually need over what is provided within asyncio, so it should be a fairly straight-forward conversion. A small example of how the code would differ: https://asyncio.readthedocs.io/en/latest/twisted.html Some thoughts: * The async/await keywords were added in Python 3.5 which means we would drop support for older versions of Python, I'd even suggest bumping the requirement to 3.6 so that we can use format strings. In my opinion, support for Python 2 should be dropped in the develop branch and for Deluge 2.0 to simplify the code and reduce the maintenance cost. * This ticket only addresses moving the Core to asyncio for the time-being. I think this would be a first good step with the UIs to follow. Some care will need to be made to make sure that the DelugeTransferProtocol is available to both core and UI as it currently stands and that plugins are also unaffected. I believe I should be able to do this in a way that would allow the UIs to continue to use Twisted with a migrated Core. * We may have to add an additional dev dependency for asynctest[1] as the standard library does not have some helpful additions this library provides. Any objections? Anything I didn't think about that may cause a problem? [0] - https://docs.python.org/3/library/asyncio.html [1] - https://github.com/Martiusweb/asynctest" feature-request new major 2.x Core develop