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

James Chapman james at uplinkzero.com
Tue Jan 2 05:06:07 EST 2018


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> 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.
>
>



More information about the Python-list mailing list