Skip to main content

HPy: The Future of Python Native Extensions

pycharm (forum hall)
30 minutes


Updating Python versions often forces us to update native extensions at the same time. But what if you need to update Python because of a security issue, but cannot (yet) move to a newer version of a dependency? Or you are running a proprietary binary extension that cannot easily be recompiled?

The HPy project provides a better C extension API for Python. It compiles to binaries that work across all versions of CPython, PyPy, GraalPy. HPy makes porting from the existing C API easy and its design ensures that the binaries we produce today stay binary compatible with future Python versions.

NumPy is the single largest direct user of the CPython C API we know of. After over 2 years of work and more than 30k lines of code ported, we can demonstrate NumPy running its tests and benchmarks with HPy. We will show the same NumPy binary run on multiple CPython versions and GraalPy. And we will discuss performance characteristics of this port across CPython, GraalPy, and PyPy.

TalkPython Internals & Ecosystem

The speakers

Štěpán Šindelář

Štěpán Šindelář

GraalPy and HPy core developer. Programming languages, virtual machines, and runtimes enthusiast. Surfer in a landlocked country.

Florian Angerer

Florian Angerer

Florian Angerer is member of the Graal project at Oracle Labs and works on GraalPy, a fast, Java-based implementation of Python. He is also core developer of HPy, a new API for extending Python in C. He received his Ph.D. in Computer Science from the Johannes Kepler University Linz, Austria.

← Back to schedule