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
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to