Artem Selivanov
Artem Selivanov

Reputation: 1957

Does PyPy work with asyncio?

Does PyPy support the aio and Python 3.5?

I need the performance of PyPy and asynchrous code of asyncio. Also I need to use async/await in my code. Is that possible?

If so, what are the nuances?

Upvotes: 11

Views: 7126

Answers (2)

Manuel Jacob
Manuel Jacob

Reputation: 2004

The current version of PyPy (version 7.2.0 at the time of writing) supports asyncio on at least Linux and Windows.


Old, now outdated (as of 2019-10-20) notes:

Currently there is a PyPy version (v7.0) compatible with Python 3.5 and a beta version (v7.1.1) compatible with Python 3.6. Both versions support asyncio on Linux (and probably macOS, but I didn’t try myself), but only the latter supports asyncio on Windows.


Old, now outdated (as of 2019-04-16) notes:

Currently PyPy supports Python 3.5, so asyncio should just work. However Python 3.x on Windows is still beta-quality. Unfortunately currently the extension module for overlapped IO, which is needed to run asyncio on Windows, isn't yet implemented.


Old, now outdated (as of 2018-06-10) notes:

Currently PyPy supports Python 3.5. Note that PyPy's Python 3 support is only beta quality in the moment. We are continuously working on improving it. It's not yet production-ready, though. Most code involving asyncio should just work. If not, please check the open bug reports or create a new one or let me know here in the comments.


Old, now outdated (as of 2017-08-18) notes:

Currently PyPy supports Python 3.3. This means that you can install asyncio on PyPy3.3. Note that PyPy's 3.3 support is only alpha / beta quality in the moment. We are however actively working on increasing performance and compatibility with CPython.

The async / await feature was added in Python 3.5. We started a very experimental branch with Python 3.5 support, but it's still got a long way to go. Luckily we have a GSoC student working on it currently, but still it could take several years (depending on how much donations and volunteer work we receive).

EDIT 1: Previously there was a feature missing to run asyncio. It was implemented shortly before this edit. The answer was edited accordingly.

EDIT 2: We just released an alpha version of PyPy3.3. We don't recommend anyone to try the old PyPy3 release supporting only Python 3.2. This is why I rewrote most of the answer.


Old, now obsolete (as of 2016-05-30) notes:

The PyPy3 version from the website is very old and only implements Python 3.2 - we haven't done a release for over one and a half year. Because Python 3.2 is missing the yield from feature, asyncio won't work with this version.

Upvotes: 27

romants
romants

Reputation: 3648

No. According to PyPy website it is only Python 3.2.5 compliant, while asyncio requires Python 3.4 (actually can be installed using pip on 3.3, thanks @dirn). Also on Asyncio Wiki, it is stated that asyncio doesn't work on PyPy yet (though Wiki was last updated in August 2015).

Upvotes: 0

Related Questions