| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: hpy |
| 3 |
Version: 0.9.1.dev61+g79fb330d |
| 4 |
Summary: A better C API for Python |
| 5 |
Home-page: https://hpyproject.org |
| 6 |
Author: The HPy team |
| 7 |
Author-email: [email protected] |
| 8 |
License: MIT |
| 9 |
Requires-Python: >=3.8 |
| 10 |
Description-Content-Type: text/markdown |
| 11 |
License-File: LICENSE |
| 12 |
License-File: AUTHORS |
| 13 |
Requires-Dist: setuptools >=64.0 |
| 14 |
Provides-Extra: dev |
| 15 |
Requires-Dist: pytest ; extra == 'dev' |
| 16 |
Requires-Dist: pytest-xdist ; extra == 'dev' |
| 17 |
Requires-Dist: filelock ; extra == 'dev' |
| 18 |
|
| 19 |
# HPy: a better API for Python |
| 20 |
|
| 21 |
[](https://github.com/hpyproject/hpy/actions/workflows/ci.yml) |
| 22 |
[](https://hpy.readthedocs.io/) |
| 23 |
[](https://discord.gg/xSzxUbPkTQ) |
| 24 |
|
| 25 |
**Website**: [hpyproject.org](https://hpyproject.org/) \ |
| 26 |
**Community**: [HPy Discord server](https://discord.gg/xSzxUbPkTQ) \ |
| 27 |
**Mailing list**: [[email protected]](https://mail.python.org/mailman3/lists/hpy-dev.python.org/) |
| 28 |
|
| 29 |
## Summary |
| 30 |
|
| 31 |
HPy is a better API for extending Python |
| 32 |
in C. The old C API is specific to the current implementation of CPython. |
| 33 |
It exposes a lot of internal details which makes it hard to: |
| 34 |
|
| 35 |
- implement it for other Python implementations (e.g. PyPy, GraalPy, |
| 36 |
Jython, IronPython, etc.). |
| 37 |
- experiment with new things inside CPython itself: e.g. using a GC |
| 38 |
instead of refcounting, or to remove the GIL |
| 39 |
- guarantee binary stability |
| 40 |
|
| 41 |
HPy is a specification of a new API and ABI for extending Python that is |
| 42 |
Python implementation agnostic and designed to hide and abstract internal |
| 43 |
details such that it: |
| 44 |
|
| 45 |
- can stay binary compatible even if the underlying Python internals change significantly |
| 46 |
- does not hinder internal progress of CPython and other Pythons |
| 47 |
|
| 48 |
Please read the [documentation](https://docs.hpyproject.org/en/latest/overview.html) |
| 49 |
for more details on HPy motivation, goals, and features, for example: |
| 50 |
|
| 51 |
- debug mode for better developer experience |
| 52 |
- support for incremental porting from CPython API to HPy |
| 53 |
- CPython ABI for raw performance on CPython |
| 54 |
- and others |
| 55 |
|
| 56 |
Do you want to see how HPy API looks in code? Check out |
| 57 |
our [quickstart example](https://docs.hpyproject.org/en/latest/quickstart.html). |
| 58 |
|
| 59 |
You may also be interested in HPy's |
| 60 |
[API reference](https://docs.hpyproject.org/en/latest/api-reference/index.html). |
| 61 |
|
| 62 |
This repository contains the API and ABI specification and implementation |
| 63 |
for the CPython interpreter. Other interpreters that support HPy natively: GraalPy |
| 64 |
and PyPy, provide their own builtin HPy implementations. |
| 65 |
|
| 66 |
|
| 67 |
## Why should I care about this stuff? |
| 68 |
|
| 69 |
- the existing C API is becoming a problem for CPython and for the |
| 70 |
evolution of the language itself: this project makes it possible to make |
| 71 |
experiments which might be "officially" adopted in the future |
| 72 |
|
| 73 |
- for PyPy, it will give obvious speed benefits: for example, data |
| 74 |
scientists will be able to get the benefit of fast C libraries *and* fast |
| 75 |
Python code at the same time, something which is hard to achieve now |
| 76 |
|
| 77 |
- the current implementation is too tied to CPython and proved to be a |
| 78 |
problem for almost all the other alternative implementations. Having an |
| 79 |
API which is designed to work well on two different implementations will |
| 80 |
make the job much easier for future ones: going from 2 to N is much easier |
| 81 |
than going from 1 to 2 |
| 82 |
|
| 83 |
- arguably, it will be easier to learn and understand than the massive |
| 84 |
CPython C API |
| 85 |
|
| 86 |
See also [Python Performance: Past, Present, |
| 87 |
Future](https://github.com/vstinner/talks/raw/main/2019-EuroPython/python_performance.pdf) |
| 88 |
by Victor Stinner. |
| 89 |
|
| 90 |
|
| 91 |
## What does `HPy` mean? |
| 92 |
|
| 93 |
The "H" in `HPy` stands for "handle": one of the key idea of the new API is to |
| 94 |
use fully opaque handles to represent and pass around Python objects. |
| 95 |
|
| 96 |
|
| 97 |
## Donate to HPy |
| 98 |
|
| 99 |
Become a financial contributor and help us sustain the HPy community: [Contribute to HPy](https://opencollective.com/hpy/contribute). |