rainwoodman / vast

vala and scientific numerical computation
11 stars 1 forks source link

GIR #3

Closed rainwoodman closed 7 years ago

rainwoodman commented 8 years ago

We shall explore GIR integration early. How to do that with meson?

@arteymix , hints?

arteymix commented 8 years ago

Right now, just pass --gir in vala_args and use a custom target to generate the typelib. It's described in https://github.com/mesonbuild/meson/wiki/Vala#gobject-introspection.

There will eventually be a vala_gir flag with a compile_typelib helper in the GNOME module.

If there's a Python test, there's some environment variable to export in order to make it run properly:

I think something like follow would do the trick:

test('vast-test.py', env: ['GI_TYPELIB_PATH=<path>', 'LD_LIBRARY_PATH=<path>'])
arteymix commented 7 years ago

Ok, I pushed a testcase using GIR with Python :+1:

https://github.com/rainwoodman/vast/blob/master/tests/gi-test.py

It's pretty elegant!

rainwoodman commented 7 years ago

Yes it is pretty elegant.

I have been wondering what happens if we write a vala function named __getitem__ and __setitem__ ; and if that works how do we plan to deal with it - subclassing or ..?

arteymix commented 7 years ago

I'm pretty sure there's a way of defining that. It seems that we can override generated code: https://mail.gnome.org/archives/commits-list/2011-February/msg02604.html

We could add friendly helpers and maybe some NumPy mode for reusing existing code.

arteymix commented 7 years ago

Ok, it seems that we can add the gi/overrides/Vast.py module to site-packages and make extensions there.

EDIT: more info here: https://wiki.gnome.org/Projects/PyGObject/OverrideGuidelines

rainwoodman commented 7 years ago

Great. The python glue stays in python. We can add helpers that no-copy converts numpy array and python buffers to and from Vast.Array there.