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
Hashes for hpy-0.9.0rc1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a080d217f7822d245994f8ac4de6352df5fbd0612010fe98316270beaa853924 |
|
MD5 | a55807119a4e3379505718e611202116 |
|
BLAKE2b-256 | 6737f5c14aabff78703b82f96a5ff432b79f61d0d072d664b1cb7ed76530d98b |
Hashes for hpy-0.9.0rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b490e75738b27ee1bd56362ee4c105d3c0a8163ddc0993430d297ef0a93468b2 |
|
MD5 | e6ae1fd136d5f018c6b78acdeb4a0965 |
|
BLAKE2b-256 | d7e61cb548fd9c5713b503decd24258d6a76a0926dd3c274f88f91cedb5cca59 |
Hashes for hpy-0.9.0rc1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b682ebf9c828e936bfc3711190a761c7b2861677014221def5b467d524ceb52 |
|
MD5 | 32625083e391c55e7e7d47d451f25c98 |
|
BLAKE2b-256 | 827499e97079a07d5d98e5a11f84d392fb763a3a4761c73f29fb89c2b5c4ba70 |
Hashes for hpy-0.9.0rc1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 973f2a7f81d3af8012f333ff5e873e1cf927c9fbcdcad32f0c02cdfe3dd45f8a |
|
MD5 | 19ea7a2e69cb33ac741267290e5c49f9 |
|
BLAKE2b-256 | dfcc1017dbae3300db735a26a4fa010f749dcd37184c3540c1c96d86bf7c3738 |
Hashes for hpy-0.9.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 279c87eb08665137b017c08e2ae8c9c248e9bba83af153695da94e6f174fddc7 |
|
MD5 | 4226c207af5b2d5866d02cadb4157e26 |
|
BLAKE2b-256 | 19defdbb2178815694e19aaa9fe125c600b79bd6d5899cc72360557379e953cb |
Hashes for hpy-0.9.0rc1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65512b95f534715dfa601a3747fa48471aacf04e84d765dde0a251832f7f3bf6 |
|
MD5 | bb5dd23fa95475d60e59e40708c623a8 |
|
BLAKE2b-256 | a9194c5464eec4fd52d8d2276369c66cbf13296e94fb21fc2ca670f89c19ffa7 |
Hashes for hpy-0.9.0rc1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ca318ef3437209b1eee067f2c3c52a52f9b055d329cb9f767e807642a17004 |
|
MD5 | 087acae1e3e32156d2416b0748a3f1ef |
|
BLAKE2b-256 | 5a18f95fd2425baff64c5bf92ea7167c68c97b2ca6ac92add592ec17f73fe918 |
Hashes for hpy-0.9.0rc1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16062288aca1dfa8a9cdceab881a520c22a4bf2a2975b54e6b17578091de5cbb |
|
MD5 | 6b3b010c89938e01c6ce8f9575d95d40 |
|
BLAKE2b-256 | 3cea506cc6be9afda4f3574b15d8f9a6104e9c0d5ddebfb185103caa5aa19d1e |
Hashes for hpy-0.9.0rc1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 332914fde391986f46bd1239f36fbcde70e5a77f05dcad564460a9b042026f27 |
|
MD5 | 7f7a3ee97d0163f11c37463a93a8a14f |
|
BLAKE2b-256 | 40df49ad36479a9511f05442a51195b52c33f5c717c41e3dbb6ed8ad34915b9e |
Hashes for hpy-0.9.0rc1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0db7671c2d85bba7df30406c9630c632c7fd96a0e55802404f8be2433830e4bf |
|
MD5 | 7f187bca5225f8fdaf1c0e27ea8633c5 |
|
BLAKE2b-256 | 55588f748bec7eb62925247e83b58d2901f19e8a3ef36f53a8e9a3fe8f5488fc |
Hashes for hpy-0.9.0rc1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12a27e19de3584d43ca640c3fda78da91ac414b2aed47f0b7bc43fe9bb24981c |
|
MD5 | 8e2dbdb51214b46af5a259eaa96489a1 |
|
BLAKE2b-256 | 4a65c9a008751f795fa8e2ed46d6b06e66aadcd5fa16591aad4ab47b07cd3ee9 |
Hashes for hpy-0.9.0rc1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27ed54807ebf3eeea774b5709eb72e929a7d114acf8fab225b86ae5334fd322d |
|
MD5 | 130e308ac5067ef03c2c97f627fea8cc |
|
BLAKE2b-256 | ea041b7fcb44efa3015861f5db12b50373f5af58eb0e0972626b0984e5005d0b |