A better C API for Python
Project description
HPy: a better API for Python
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file hpy-0.9.0.tar.gz
.
File metadata
- Download URL: hpy-0.9.0.tar.gz
- Upload date:
- Size: 349.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4545310f3a7f9ac249c0f19a80a9b05f46565afb62b7e9225b79493b7b6c70cc |
|
MD5 | df3950d91a50d1a6845c5811849b7197 |
|
BLAKE2b-256 | 1ea84bea72ae9292abf33910f2568d8318e11a72353327aecc3c41c38a916773 |
File details
Details for the file hpy-0.9.0-cp311-cp311-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp311-cp311-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4da5eb577c80b820e50ccdcd63b9739ce128784d297047d04954c18c3d383a |
|
MD5 | e10b5dccb24ba0f222106c4b76db2d9d |
|
BLAKE2b-256 | 8f317061c437d01aeb08b126eafec143e13afb7da0f172d63e49d17254fe2397 |
File details
Details for the file hpy-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b42aff81a6797ad01d314940d8aadddedeb987c42f00453079553c15fbf70a |
|
MD5 | 890659b8d3bfa0fad1d262fca670de9f |
|
BLAKE2b-256 | 20c4056a3b9618efa6114b4698e8418fdaae1336eab4f319e31f30e96a9cc05d |
File details
Details for the file hpy-0.9.0-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 570.8 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fe2d66854185a265beb025a914bdb19d7b76ae0bb30ee0eb74019f4911931b7 |
|
MD5 | 937c96970e209e62b64d40dd4012b01e |
|
BLAKE2b-256 | fdd57e9368b3820da8ebc01391f75afecda5199b6883223ec4d6909c9a7f1dbb |
File details
Details for the file hpy-0.9.0-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9c830946e5e9249069f02b179a4ed8ca56d96409966585b235ad6128b809b49 |
|
MD5 | 54bc76bdd3b925aefefeb2719ed164c1 |
|
BLAKE2b-256 | 1a4193169022443235d12555fd8069d421969adcaf92695cc5d2617ab0f8cfe3 |
File details
Details for the file hpy-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 365b0837d6e0a6aff9ee8960cc9a5f2ff0e1f99c5509f4d85c887145a097285b |
|
MD5 | e550740617a530d5d68b6060373412c5 |
|
BLAKE2b-256 | 8f69442b24743e9d7af218de214e7c2eaea2fbb01b88cb7b7481a119b691f247 |
File details
Details for the file hpy-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 572.8 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5097364c4356444b0cefaad463d270a20a90ae0700b29122d68fabbbd5ac5cf |
|
MD5 | da3311d01d81c6bfb321c9c87bab5605 |
|
BLAKE2b-256 | f898d276a77d726d5c0a8af45fb40c228a02676afafe2c1fcd684fd70d9d7911 |
File details
Details for the file hpy-0.9.0-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e49dab221111e49f719b8f17769eae4d233924038e1567c3deca230ff10fa89 |
|
MD5 | 0a3ef4eb20874b8a3382ed8ac9d11704 |
|
BLAKE2b-256 | 12676c50e7a4ade23548a90d069cdd936f89b9848a27d92456905481b7c98790 |
File details
Details for the file hpy-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0901040f1563cda561c19bad8b94cbc548d28ace43d02cb50a12c4d20ef1a089 |
|
MD5 | eeba0bc7e5f74c54dacb8bda797ad498 |
|
BLAKE2b-256 | 985be972702a6c420d3c1ff1dbf7f3474e44403c68ee4fe16ba8d7ecbcbf4fac |
File details
Details for the file hpy-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 569.8 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ff1048e837e0568b6cfbd3d3148f82ea9e9a535f835d4f5f36e9537b9b7b159 |
|
MD5 | 62d2ca83ba448ad07072b17032d23b81 |
|
BLAKE2b-256 | 71b623ce30bbf321a031d8a5046e8befa2dcec4fbf49da440617ae096f412f49 |
File details
Details for the file hpy-0.9.0-cp38-cp38-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d71fc3676b285ef5058c43c4b478278cf7965387f4c10117c36e946db5c65a3e |
|
MD5 | a00c4b4722eab714834e0f03011f1dc7 |
|
BLAKE2b-256 | b2e7c5aea7f962c937b0d5975c37a56db363cd22c81bf9735b02a6cb1cb22ced |
File details
Details for the file hpy-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8455223916b29c6c9f6ba5893e2063e340d2d508a619b261e41013bddb30718f |
|
MD5 | 3209dff62709855cc650fa88e885afec |
|
BLAKE2b-256 | af35c15087e31af04f2176cfc5eaeeeac93be2f1717f7bec66757d5f08df1263 |
File details
Details for the file hpy-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: hpy-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 579.9 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaea46b340a91e0009559bbc5ddc20bd79f2507cfcb23527d1d9dd191022b1ae |
|
MD5 | fe381bf823a0509fe13db2ec981e782c |
|
BLAKE2b-256 | fc70a107f724d320e78ee527900d2e4d7cd577e72ff0a10267d988499d72b26d |