python: initial impl of bindings using cFFI

A PoC that exposes single function
`enry.language_by_extension()` and a small
number of helpers to deal with string
coversion between Go<->C<->Python.

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
This commit is contained in:
Alexander Bezzubov
2019-06-01 19:47:13 +02:00
parent 6a6a3cc26e
commit ee7a0f1139
5 changed files with 111 additions and 0 deletions

29
python/README.md Normal file
View File

@ -0,0 +1,29 @@
# Python bindings for enry
Python bingings thoug cFFI (API, out-of-line) for calling enr Go functions though CGo wrapper.
## Build
```
$ make static
$ python enry_build.py
```
Will build static library for Cgo wrapper `libenry`, then generate and build `enry.c`
- a CPython extension that
## Run
Example for single exposed API function is provided.
```
$ python enry.py
```
## TODOs
- [ ] try ABI mode, to aviod dependency on C compiler on install (+perf test?)
- [ ] ready `libenry.h` and generate `ffibuilder.cdef` content
- [ ] cover the rest of enry API
- [ ] add `setup.py`
- [ ] build/release automation on CI (publish on pypi)
-