Binding regex from Python


I have a need for using the regex crate from Python (translation: Python <-> C <-> Rust). I’ve tried 3 different approaches, and they all have their downsides.

My first attempt was using cffi and manually writing simple FFI functions in Rust [1].
This attempt I’m not confident in, as I’m sure there are gotchas that I’m not aware of.

After doing more research, I discovered the existing C binding (rure).
My second attempt was to write a simple wrapper of rure, to make it easy to build a binary wheel for Python [2].
This attempt failed, and I’m not familiar enough with Rust (or C) to figure out why.
I tried several variations of wrapping rure, but they all failed in similar ways (either Python’s cffi responding with symbols missing from the library, or null pointers for structs).

My 3rd attempt was to forego the wrapper and instead include the small amount of Python code directly in the regex-capi crate [3].
I don’t mind maintaining a fork in my personal GitHub account for this glue code, but that seems flaky.
I also don’t want to foist maintaining Python bindings on the regex maintainers (as it seems rure-go was split out to a distinct repo [4])