[PyQt] Generating PyQt bindings with Clang

Shaheed Haque srhaque at theiet.org
Fri May 20 08:23:51 BST 2016


Just to clarify a couple of things...

On 19 May 2016 17:51, "Phil Thompson" <phil at riverbankcomputing.com> wrote:
>
> On 19 May 2016, at 5:24 pm, Stephen Kelly <steveire at gmail.com> wrote:
> >
> > On Thu, May 19, 2016 at 5:47 PM, Phil Thompson
> > <phil at riverbankcomputing.com> wrote:
> >> On 18 May 2016, at 10:50 pm, Stephen Kelly <steveire at gmail.com> wrote:
> >>>
> >>>
> >>> In case you missed it, myself and Shaheed have been making progress on
> >>> generating bindings for KDE Frameworks 5 using clang:
> >>>
> >>>
https://steveire.wordpress.com/2016/05/18/generating-python-bindings-with-clang/
> >>
> >> In case you weren't aware PyQt .sip files are also derived from Clang
(specifically CastXML).
> >
> > Oh, I didn't know that. Is the tool you use FOSS/usable for KDE etc?
>
> https://www.riverbankcomputing.com/hg/metasip/
>
> I describe MetaSIP as a personal productivity tool and a work in
progress. Unsurprisingly it fits the way I work - it may not fit how
anybody else works.
>
> From what I understand you want to be able to generate bindings
automatically from the C++ .h files.

Yes and no. The idea is to use Clang to do the grunt work much as it sounds
like you are doing but then automate the post processing by:

1. Using a simple rule engine to fix some code directly. The rule part is
used to identify applicable places in the code and then 2 or 3 lines of
python code is often enough to do the edit (or discard).

2. Using the rule engine to insert manual code fragments at the Method,
Type and Module levels. This manual code can be stored text or function
generated. The function driven part lends itself to avoiding duplication of
text.

3. Extending the function part of 2 to do automatic generation of
%MappedType logic for commonly templated cases such as QList and QMap etc.

Seen that way it is more about easing the maintenance of the binding than
anything else.

Thanks, Shaheed

I have never tried to be that ambitious. MetaSIP is a GUI tool that
provides a lot of automated assistance to what is basically a manual
process. Personally I think the only way to ensure quality in bindings
(both in terms of Pythonic behaviour and bugs) is to check each argument of
each function call. The key to it being manageable is to make sure you do
that check once and once only.
>
> Phil
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160520/e7bd1d85/attachment.html>


More information about the PyQt mailing list