Skip to main content

A better C API for Python

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hpy-0.9.0rc2.tar.gz (348.9 kB view details)

Uploaded Source

Built Distributions

hpy-0.9.0rc2-cp311-cp311-musllinux_1_1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

hpy-0.9.0rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

hpy-0.9.0rc2-cp311-cp311-macosx_10_9_x86_64.whl (570.8 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

hpy-0.9.0rc2-cp310-cp310-musllinux_1_1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

hpy-0.9.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

hpy-0.9.0rc2-cp310-cp310-macosx_10_9_x86_64.whl (572.8 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

hpy-0.9.0rc2-cp39-cp39-musllinux_1_1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

hpy-0.9.0rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

hpy-0.9.0rc2-cp39-cp39-macosx_10_9_x86_64.whl (569.8 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

hpy-0.9.0rc2-cp38-cp38-musllinux_1_1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

hpy-0.9.0rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

hpy-0.9.0rc2-cp38-cp38-macosx_10_9_x86_64.whl (579.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file hpy-0.9.0rc2.tar.gz.

File metadata

  • Download URL: hpy-0.9.0rc2.tar.gz
  • Upload date:
  • Size: 348.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for hpy-0.9.0rc2.tar.gz
Algorithm Hash digest
SHA256 aed491f3d988a71c2bfa687cd5853a4880cdb7fde7847d035d643698aa968eee
MD5 30718f0b68281707d90dd44c84d5a34d
BLAKE2b-256 166946fe4b5ac396b7565a2e2ab404132f7b93de394f01ec20c11fefcf202de1

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 64795d37a37b093bdabb7a9063232af51febae681c08ed71c498fe4116f2c917
MD5 853c6f83d3a0de3132848be288930f0f
BLAKE2b-256 19b3a7635e6504b6d219ec25c2cf036f5ee370b7b25aea9a931f1e8304ae1339

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 910f1c07845f873120882db252036476be89e04709324e47bc6939773bbd788c
MD5 4220e0172742d30513129d21c081cf98
BLAKE2b-256 b3120a221db275748a0cdbadef540c0321a7ba24a0842b5ef1fa69a801530d91

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27de0d87926a6a97dad73f854937d9263bd080e95967878845ce431d5660881e
MD5 f170deadddebb00096015a06ea36e769
BLAKE2b-256 5a7213e491ca8cdb9d781b38294927ab32045829d0c3f19aeef0f7fc31b0229a

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b0ad0be1fc8c2040ba88f75003553c26c65e362f3bf481d83e01b79567f273a5
MD5 a18b9a60f5795c3ea1d4d400d30a1bd6
BLAKE2b-256 f2a93e116547d5cd45dbe388c17f7a1b8bb2f3372ba73023a1cee42f17e4d55d

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1edd77a17c6a145d0318730a5ac6bdd50abbb2c5f74060f816057ae4fb87b35
MD5 faf367c5055d231461f3f594afcedf97
BLAKE2b-256 7e2f1633e6be37fa9c0c4a8a3e00d598dd1acddcd004b43f8cb49fa72d47bbf7

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f4afd68241339a4ba5e5fdd31ab63a80f574a979d679174dc55df08dabbcaf71
MD5 e953887aae7eb8ce4a15915514742130
BLAKE2b-256 6154ace2dd4dfe7f76c384554474ac9579f16ab31aafe8c88ce80154b7c108f3

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 23d3bfa265bfa8f41cb435f08e3c3310283ef1911e85bdb9bbc31870efc41d46
MD5 8ddbef15ab85f87b135a0cfc3ee8a2fe
BLAKE2b-256 4a093b0cff05fd4ce9fe915a080de93d125876ab4b25d21dd835588f24fabf28

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c9896d805a197f1f632a4160bcda271d45500abea563d2b4a06155fc3115e95d
MD5 8aeee90146598b1c4f2d428c3eaf26df
BLAKE2b-256 7f8c030bf96d8497b78ee5e76555f86b859e58cd73254cade5d540cafb9bdaba

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6892c3ecf1b4e958110cf36f87de83363167ca5976eef6959168ad56acb0bade
MD5 38fffe94e69b96f6e53b913a647e4284
BLAKE2b-256 86621f9345b800f95634721c31e0e61f80798d0796d4be6774d35c7108b68e24

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 25532c2888c62d316fae0eeeaaf19a8e2190adacb5e912ddca15b7b0923a9006
MD5 f14ed2583e9095a0d71151ab48f5256f
BLAKE2b-256 4a05aac7b2ed451e61acee3ef36518e809959c0d9f33905a1c44377dea755b66

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c31f8d5e4c06f83c3d52c9e3935b3e964b661dc11db294defaff27b014080fee
MD5 612b2a03544c44f4edef4cd678b793fe
BLAKE2b-256 4a3ecffd01f806119b3c3c7ff6bd6968b7c2082a4b5e5738c41846e7caae4691

See more details on using hashes here.

Provenance

File details

Details for the file hpy-0.9.0rc2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for hpy-0.9.0rc2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f11ff085bf4aac72380e59d54fee9794be70e81f32ebd9e469fe80c81925a5ae
MD5 d55b8ec504c8c4ec9b48a93541cf10e3
BLAKE2b-256 e7270582c02b99ca51584ce42e8f63da358338fa88f0e4b4d42f3a1b43950112

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page