How to create a python extension module from a shared library?

Etienne Robillard tkadm30 at yandex.com
Tue Jan 2 05:17:39 EST 2018


Hi James,

Thanks for your input.

I want to make a native Python application (uwsgictl) to dispatch FIFO 
commands to the master uWSGI process.

uwsgictl would depend on libuwsgi.so, a uWSGI plugin included in the 
distribution.

My goal is to use CFFI to generate python bindings for libuwsgi.so using 
clang interpreter. :)


Best regards,

Etienne


Le 2018-01-02 à 05:06, James Chapman a écrit :
> Hi Etienne,
>
> I'm not familiar with uSWGI, so I started here: 
> https://uwsgi-docs.readthedocs.io/en/latest/Hooks.html
> AFAIK there are a number of hooks already exposed and available to 
> Python apps.
>
> However, if I've understood your question correctly, you want to 
> extend uWSGI itself by writing some python code which is then 
> translated/generated into C code? You refer to AST generation but why 
> are you doing this? Maybe my unfamiliarity with uWSGI is preventing me 
> from understanding exactly what it is you are trying to do, but 
> further clarification would go a long way.
>
> If your goal is actually to extend uWSGI via a plugin, then there's 
> more to just writing some python, you'll need to write some C code (I 
> wouldn't bother trying to generate this as it'll probably not work):
> https://github.com/unbit/uwsgi-docs/blob/master/tutorials/WritingPlugins.rst
>
> If you look here, there's a link to each 3rd party plugin (mostly 
> GitHub) where you can see the source code for each plugin. This is a 
> very good starting point as there are many examples here:
> https://uwsgi-docs.readthedocs.io/en/latest/ThirdPartyPlugins.html
>
> Perhaps you can clarify.
>
> James
>
>
>
>
> On 30 December 2017 at 01:00, Etienne Robillard <tkadm30 at yandex.com 
> <mailto:tkadm30 at yandex.com>> wrote:
>
>     Hi all,
>
>     I would like to extend uWSGI by creating a CPython extension
>     module for the libuwsgi.so shared library included in the
>     distribution.
>
>     My goal is to use this automatically generated CPython module for
>     extending uWSGI.
>
>

-- 
Etienne Robillard
tkadm30 at yandex.com
https://www.isotopesoftware.ca/




More information about the Python-list mailing list