Skip to main content

HPy: a better API for Python

Build Documentation Join the discord server at https://discord.gg/xSzxUbPkTQ

Website: hpyproject.org
Community: HPy Discord server
Mailing list: hpy-dev@python.org

Summary

HPy is a better API for extending Python in C. The old C API is specific to the current implementation of CPython. It exposes a lot of internal details which makes it hard to:

  • implement it for other Python implementations (e.g. PyPy, GraalPy, Jython, IronPython, etc.).
  • experiment with new things inside CPython itself: e.g. using a GC instead of refcounting, or to remove the GIL
  • guarantee binary stability

HPy is a specification of a new API and ABI for extending Python that is Python implementation agnostic and designed to hide and abstract internal details such that it:

  • can stay binary compatible even if the underlying Python internals change significantly
  • does not hinder internal progress of CPython and other Pythons

Please read the documentation for more details on HPy motivation, goals, and features, for example:

  • debug mode for better developer experience
  • support for incremental porting from CPython API to HPy
  • CPython ABI for raw performance on CPython
  • and others

Do you want to see how HPy API looks in code? Check out our quickstart example.

You may also be interested in HPy's API reference.

This repository contains the API and ABI specification and implementation for the CPython interpreter. Other interpreters that support HPy natively: GraalPy and PyPy, provide their own builtin HPy implementations.

Why should I care about this stuff?

  • the existing C API is becoming a problem for CPython and for the evolution of the language itself: this project makes it possible to make experiments which might be "officially" adopted in the future

  • for PyPy, it will give obvious speed benefits: for example, data scientists will be able to get the benefit of fast C libraries and fast Python code at the same time, something which is hard to achieve now

  • the current implementation is too tied to CPython and proved to be a problem for almost all the other alternative implementations. Having an API which is designed to work well on two different implementations will make the job much easier for future ones: going from 2 to N is much easier than going from 1 to 2

  • arguably, it will be easier to learn and understand than the massive CPython C API

See also Python Performance: Past, Present, Future by Victor Stinner.

What does HPy mean?

The "H" in HPy stands for "handle": one of the key idea of the new API is to use fully opaque handles to represent and pass around Python objects.

Donate to HPy

Become a financial contributor and help us sustain the HPy community: Contribute to HPy.

Release files for hpy 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hpy 0.9.0
File Size Uploaded
hpy-0.9.0.tar.gz 349.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for hpy 0.9.0
File
hpy-0.9.0-cp311-cp311-musllinux_1_1_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.1+ x86-64 Details
hpy-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
hpy-0.9.0-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
hpy-0.9.0-cp310-cp310-musllinux_1_1_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.1+ x86-64 Details
hpy-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
hpy-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
hpy-0.9.0-cp39-cp39-musllinux_1_1_x86_64.whl CPython 3.9 CPython 3.9 Linux musl 1.1+ x86-64 Details
hpy-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
hpy-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
hpy-0.9.0-cp38-cp38-musllinux_1_1_x86_64.whl CPython 3.8 CPython 3.8 Linux musl 1.1+ x86-64 Details
hpy-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
hpy-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details

Total release size: 13.8 MB

Release files / hpy-0.9.0.tar.gz

Download URL hpy-0.9.0.tar.gz
Size 349.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4545310f3a7f9ac249c0f19a80a9b05f46565afb62b7e9225b79493b7b6c70cc
BLAKE2b-256 checksum
How to use checksums
1ea84bea72ae9292abf33910f2568d8318e11a72353327aecc3c41c38a916773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp311-cp311-musllinux_1_1_x86_64.whl

Download URL hpy-0.9.0-cp311-cp311-musllinux_1_1_x86_64.whl
Size 1.5 MB
Tags CPython 3.11 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
0a4da5eb577c80b820e50ccdcd63b9739ce128784d297047d04954c18c3d383a
BLAKE2b-256 checksum
How to use checksums
8f317061c437d01aeb08b126eafec143e13afb7da0f172d63e49d17254fe2397
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hpy-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
48b42aff81a6797ad01d314940d8aadddedeb987c42f00453079553c15fbf70a
BLAKE2b-256 checksum
How to use checksums
20c4056a3b9618efa6114b4698e8418fdaae1336eab4f319e31f30e96a9cc05d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp311-cp311-macosx_10_9_x86_64.whl

Download URL hpy-0.9.0-cp311-cp311-macosx_10_9_x86_64.whl
Size 570.8 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
6fe2d66854185a265beb025a914bdb19d7b76ae0bb30ee0eb74019f4911931b7
BLAKE2b-256 checksum
How to use checksums
fdd57e9368b3820da8ebc01391f75afecda5199b6883223ec4d6909c9a7f1dbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp310-cp310-musllinux_1_1_x86_64.whl

Download URL hpy-0.9.0-cp310-cp310-musllinux_1_1_x86_64.whl
Size 1.5 MB
Tags CPython 3.10 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
e9c830946e5e9249069f02b179a4ed8ca56d96409966585b235ad6128b809b49
BLAKE2b-256 checksum
How to use checksums
1a4193169022443235d12555fd8069d421969adcaf92695cc5d2617ab0f8cfe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hpy-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
365b0837d6e0a6aff9ee8960cc9a5f2ff0e1f99c5509f4d85c887145a097285b
BLAKE2b-256 checksum
How to use checksums
8f69442b24743e9d7af218de214e7c2eaea2fbb01b88cb7b7481a119b691f247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl

Download URL hpy-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl
Size 572.8 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
c5097364c4356444b0cefaad463d270a20a90ae0700b29122d68fabbbd5ac5cf
BLAKE2b-256 checksum
How to use checksums
f898d276a77d726d5c0a8af45fb40c228a02676afafe2c1fcd684fd70d9d7911
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp39-cp39-musllinux_1_1_x86_64.whl

Download URL hpy-0.9.0-cp39-cp39-musllinux_1_1_x86_64.whl
Size 1.5 MB
Tags CPython 3.9 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
3e49dab221111e49f719b8f17769eae4d233924038e1567c3deca230ff10fa89
BLAKE2b-256 checksum
How to use checksums
12676c50e7a4ade23548a90d069cdd936f89b9848a27d92456905481b7c98790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hpy-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0901040f1563cda561c19bad8b94cbc548d28ace43d02cb50a12c4d20ef1a089
BLAKE2b-256 checksum
How to use checksums
985be972702a6c420d3c1ff1dbf7f3474e44403c68ee4fe16ba8d7ecbcbf4fac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl

Download URL hpy-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 569.8 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
3ff1048e837e0568b6cfbd3d3148f82ea9e9a535f835d4f5f36e9537b9b7b159
BLAKE2b-256 checksum
How to use checksums
71b623ce30bbf321a031d8a5046e8befa2dcec4fbf49da440617ae096f412f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp38-cp38-musllinux_1_1_x86_64.whl

Download URL hpy-0.9.0-cp38-cp38-musllinux_1_1_x86_64.whl
Size 1.5 MB
Tags CPython 3.8 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
d71fc3676b285ef5058c43c4b478278cf7965387f4c10117c36e946db5c65a3e
BLAKE2b-256 checksum
How to use checksums
b2e7c5aea7f962c937b0d5975c37a56db363cd22c81bf9735b02a6cb1cb22ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hpy-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8455223916b29c6c9f6ba5893e2063e340d2d508a619b261e41013bddb30718f
BLAKE2b-256 checksum
How to use checksums
af35c15087e31af04f2176cfc5eaeeeac93be2f1717f7bec66757d5f08df1263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5

Release files / hpy-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl

Download URL hpy-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 579.9 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
eaea46b340a91e0009559bbc5ddc20bd79f2507cfcb23527d1d9dd191022b1ae
BLAKE2b-256 checksum
How to use checksums
fc70a107f724d320e78ee527900d2e4d7cd577e72ff0a10267d988499d72b26d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page