What is HPy?
HPy provides a new API for extending Python in C. In other words, you use
#include <hpy.h> instead of
What are the advantages of HPy?
Zero overhead on CPython: extensions written in HPy runs at the same speed as "normal" extensions.
Debug Mode: in debug mode, you can easily identify common problems such as memory leaks, invalid lifetime of objects, invalid usage of APIs. Have you ever forgot a
Py_DECREF? The HPy debug mode will detect these mistakes for you.
Universal binaries: extensions built for the HPy Universal ABI can be loaded unmodified on CPython, PyPy, GraalPython, etc.
Nicer API: the standard Python/C API shows its age. HPy is designed to overcome some of its limitations, be more consistent, produce better quality extensions and to make it harder to introduce bugs.
HPy is still in an early stage of development and there is no official release yet. We hope to make our first alpha release in the next months but we don't have any ETA.
The Python/C API is huge and at the moment only a small fraction of it is available in HPy. We are experimenting by porting existing extensions to HPy and adding/designing new functionalities on a per-need basis.
We welcome your design input or adventurous alpha testing.
The extensions that we are experimenting with include:
ultrajson-hpy: this was the first real-world module to be ported to HPy. It is a nice fit because it only exports functions (as opposed as custom types) and requires only a small number of API functions.
piconumpy: as the name suggests, this is a minimal numpy-like module which defines a custom type (similar to
ndarraybut with many fewer features of course).
numpy-hpy: one of our ambitious goals is to port numpy to HPy, and to use this experience to better understand how to design the API. This is still at a very early stage though.
This website and the logo are ugly
We know: we have expertise in Virtual Machines, Compilers, low-level programming, etc, but zero expertise in web development or graphic design. PRs are welcome ;)