finds.dev

dabeaz/bitey

View on GitHub

★ 607PythonNOASSERTIONupdated Sep 2017

// the take

Bitey lets you compile C to LLVM bitcode with clang and then `import` the resulting .o file directly into Python, no wrapper code required. It uses llvm-py to JIT the bitcode and builds ctypes bindings automatically from the type information in the bitcode. It's a proof-of-concept from David Beazley, circa 2012.

The core trick is genuinely clever: LLVM bitcode retains enough type information that ctypes bindings can be generated automatically, which is the hard part of every other C-extension approach. The import hook is clean — `import bitey` once, then `import yourmodule` just works. Pre/post load files give you a reasonable escape hatch for struct field naming and library pre-loading without requiring a separate config format. Performance matches plain ctypes, which is the correct ceiling to benchmark against.

Abandoned in 2012 and hard-pinned to LLVM 3.1 and llvm-py, a library that itself died years ago — you cannot actually run this on any modern system without significant archaeology. Struct fields are exposed as e0, e1, e2 by default because LLVM bitcode doesn't preserve field names; the pre-load workaround is manual busywork. No support for C++ by design, and no path to it. The entire concept was superseded by cffi (which does this better) and Cython, and more recently by tools like nanobind and pybind11 for the C++ crowd.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
607
Forks
31
Language
Python
License
NOASSERTION
Last commit
11 Sep 2017

// nearby

If bitey isn't quite it.

All repos →