
I'm playing with the cffi embedding interface. I dusted off the uwsgi pypy plugin and began porting it to the new interface. I'm very impressed at how little C is required to make it work. The Python code embedded in the module, that attaches Python functions to uwsgi's plugin interface with @ffi.def_extern(), could be replaced with "import <module passed as uwsgi argument>" and you could iterate on this without (the 1-second of) recompiling each time. A suitably motivated person could build an ASGI server this way. Need to look up how to initialize virtualenv at the Python level. I had more success with pypy 7.1.1 which seemed to be finding the virtualenv based on the working directory. Currently pypy 7.3.1 is having trouble finding the os module in pypy_init_home. And this patch https://foss.heptapod.net/pypy/cffi/issues/450 is needed to get rid of a warning. When it works the cool demo would be to compile suffixed variants of the plugin for pypy and cpython, having one uwsgi emperor mange servers in both languages. It's at https://github.com/unbit/uwsgi/pull/2146/files Cheers, Daniel Holth

Hi Daniel, On Thu, 23 Apr 2020 at 09:08, Daniel Holth <dholth@gmail.com> wrote:
Need to look up how to initialize virtualenv at the Python level. I had more success with pypy 7.1.1 which seemed to be finding the virtualenv based on the working directory. Currently pypy 7.3.1 is having trouble finding the os module in pypy_init_home. And this patch https://foss.heptapod.net/pypy/cffi/issues/450 is needed to get rid of a warning.
Can you give a reproducer for the problem you see in finding the os module in pypy_init_home? Thanks! A bientôt, Armin.

Is anyone else interested in using uwsgi + pypy? My cffi plugin https://github.com/unbit/uwsgi/pull/2170 is working fairly well now in ordinary WSGI mode, with --mount=/app=hello.py support. I spent a while trying to port uwsgi's experimental asyncio loop over to pypy using pypy's builtin greenlets. In this mode an external event loop drives uwsgi's i/o.The uwsgi async API demo https://github.com/unbit/uwsgi/blob/master/tests/websockets_chat_async.py was enough to get working with continulets, but I mostly got segfaults trying to rewrite the more complicated and experimental asyncio event loop "asyncio.c" to an "asyncio.py" using pypy's greenlets. So I gave up on async for now. I'm developing against a nightly build of pypy Python 3.6.9 (d011d093933c, May 20 2020, 01:00:25), PyPy 7.3.2-alpha0.

Hi Daniel, On Thu, 23 Apr 2020 at 09:08, Daniel Holth <dholth@gmail.com> wrote:
Need to look up how to initialize virtualenv at the Python level. I had more success with pypy 7.1.1 which seemed to be finding the virtualenv based on the working directory. Currently pypy 7.3.1 is having trouble finding the os module in pypy_init_home. And this patch https://foss.heptapod.net/pypy/cffi/issues/450 is needed to get rid of a warning.
Can you give a reproducer for the problem you see in finding the os module in pypy_init_home? Thanks! A bientôt, Armin.

Is anyone else interested in using uwsgi + pypy? My cffi plugin https://github.com/unbit/uwsgi/pull/2170 is working fairly well now in ordinary WSGI mode, with --mount=/app=hello.py support. I spent a while trying to port uwsgi's experimental asyncio loop over to pypy using pypy's builtin greenlets. In this mode an external event loop drives uwsgi's i/o.The uwsgi async API demo https://github.com/unbit/uwsgi/blob/master/tests/websockets_chat_async.py was enough to get working with continulets, but I mostly got segfaults trying to rewrite the more complicated and experimental asyncio event loop "asyncio.c" to an "asyncio.py" using pypy's greenlets. So I gave up on async for now. I'm developing against a nightly build of pypy Python 3.6.9 (d011d093933c, May 20 2020, 01:00:25), PyPy 7.3.2-alpha0.
participants (2)
-
Armin Rigo
-
Daniel Holth