Thursday, October 23, 2014

Update on python-glibc

My pure-python bindings to glibc are progressing at a nice rate. I've made some interesting changes today that I'd like to share.
  • First, there is a clear difference between the raw glibc functions (all in the glibc module) and anything else. You can use them directly just as you would have from C. There's no magic going on and it's all there.
  • Second, we now have a growing collection of python wrappers (in the new pyglibc package), that give low-level primitives nice, high-level, pythonic API. Some of those are straight out of Python 3.4 (but are not a code copy), those include selectors.EpollSelector and select.epoll, some are custom (there's nothing to based this on) like signalfd and pthread_sigmask. More are on the way.
  • Third, and this is pretty interesting. I've decided to build a PEP3156 compatible event loop API. This is paramount for how this code can be consumed. It should roughly work out of the box as a drop-in replacement for the Python 3.4 only asyncio module. Did I mention that it works on Python 2.7? A lot is still missing but I am making progress. This ultimately means that once my contraption makes it into plainbox it won't have to be supported forever (aka job security) and can be discarded once we can depend on Python 3.4. It also means there's a clear, well defined API, a reference implementation (and some others if you look hard enough.
All of that is coming in the 0.6 release that I plan to make later today. The API is stable as I don't like changing my examples over and over so if you want to give it a try, please do so.

My ultimate goal is to scratch my itch. I want to build a reliable test launcher that does monitoring and cleanup. My only constraint is support for Python 3.2 on Ubuntu 12.04 that I have to support. I'm doing a little bit more by supporting Python 2.7 (since it's not costing me anything) on anything that is running the recent enough glibc.

If you're interested in discussing this, using it, adding patches or the like, ping me please.