ali5h/zig-py-sample
sample python extension in zig
This is tested on Ubuntu with python3.8
installed.
# build the extension
$ zig build
# run zig tests
$ zig build test
# run python tests
$ pytest
src/sum.zig
src/ffi.zig
and translated headers are in src/python3.8.zig
src/pysum.zig
src/callpy.zig
python3.8.zig
is generated by running
$ zig translate-c /usr/include/python3.8/Python.h -I/usr/include/python3.8 -I /usr/include -I /usr/include/x86_64-linux-gnu/ -D__sched_priority=0 -DNDEBUG > src/python3.8.zig