Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    H

    HPy Blog

    hpyproject.org · Company blog · on HN since 2021

    The HPy project team writes about HPy, a new C API for extending Python that works across multiple Python implementations.

    Visit blogHN submissions
    Languages & CompilersProgrammingOpen Source & Linux
    What HN says

    Commenters point to HPy as a promising fix for slow C extension support in PyPy and the constraints of CPython's PyObject-based C API.

    Stats for nerds
    18HN people shared it
    10linked in comments
    645story points
    Sep 2025last shared
    2021people per year2025

    Top posts on HN

    1. 1
      Hello, HPy
      2 people · 346 points · first shared 2021 · 52 comments on HN
    2. 2
      HPy – A better C API for Python
      12 people · 291 points · first shared 2021 · 87 comments on HN
    3. 3
      HPy [New C API for Python] Status Update
      2 people · 3 points · first shared 2021 · Discussion on HN
    4. 4
      HPy – A Better C API for Various Python Implementations
      1 person · 2 points · first shared 2021 · Discussion on HN
    5. 5
      Hpy 0.0.2: First Public Release
      1 person · 2 points · first shared 2021 · Discussion on HN
    6. 6
      Hpy 0.9.0: Fourth public release
      1 person · 1 points · first shared 2023 · Discussion on HN

    What HN people wrote when they linked it

    • throwaway894345Dec 2021

      I've battled with Python's packaging systems and other tooling and performance problems for more than a decade. Every couple of years some new thing comes along promising to fix package management, but it always fails spectacularly on some important, mainstream package or use case. I suspect a lot of this complexity comes down to the significant degree in which the Python ecosystem depends on C: not only do we need to package Python programs but C programs as well, and some people think we should ship C source code and build on the target machine and others think we should ship pre-built C binaries and dynamically link against them on the target machine thus Python supports both mechanisms; however, both are perilous in the general case.

      And interestingly, Python depends so hard on C because CPython is very slow, and CPython is very slow because the C-extension API is virtually the whole of the CPython interpreter (many interesting optimizations to the interpreter would break compatibility in the ecosystem). So it certainly feels like all of Python's major problems come down to this decision to lean hard on C and specifically to make so much of the interpreter available for the C-extensions.

      The way out as far as I can tell is to define some narrower API surface (e.g., https://hpyproject.org), get the ecosystem to consolidate around that, deprecate the old API surface, and then make the requisite breaking optimizations such that the ecosystem can feasibly do more in native…

    • ashvardanianOct 2024

      Hey!

      First of all, cool to see some activity on this front!

      I’ve written a fair share of pure CPython bindings and regularly post about implementing them with minimal overhead (<https://ashvardanian.com/posts/discount-on-keyword-arguments-in-python/>) and would love to share a few recommendations, questions, and concerns :)

      Just a suggestion to help you grow—I'd restructure the landing page (<https://hpyproject.org/>) and the README of the repo (<https://github.com/hpyproject/hpy>). It could benefit from some examples to clarify the "Nicer API" bullet point. Maybe these could be taken from the API documentation page (<https://docs.hpyproject.org/en/latest/api.html>). The page could also be more convincing with some supporting stats in favor of PyPy, GraalPython, and other Python runtimes. A reader like me might not be sure if they have enough usage and are stable enough.

      Avoiding singletons and having encapsulated context objects like `HPyContext` is definitely a great thing to have, especially in the multi-threaded Python future or in complex environments with multiple sub-interpreters. But this doesn't really solve the problem if, under the hood, the `HPyContext` still redirects to CPython's singleton.

      I've also looked at the linked benchmarks (<https://pypy.org/posts/2019/12/hpy-kick-off-sprint-report-1840829336092490938.html>). They are dated from 2019, five years ago, and already mention CPython's `METH_FASTCALL` fast calling convention, but it seems like they are…

    • mananaysiempreMay 2024

      > numpy (and swig) predates Unladen Swallow

      Sure, but that doesn’t contradict what I said. Numpy is surprisingly old, but in 2010 (my impression was that) supporting it was in no way table stakes for an implementation of Python. Hell, Jython was still occasionally taken seriously then, and Microsoft still pretended they cared about IronPython.

      > I would suggest the C API is just as much a part of Python as the standard library

      As things stand, yes, no question.

      The problem is, it was never designed that way. In particular, it cannot (or at least is not designed to) support any other memory management strategy but CPython’s, thus efforts like HPy[1]. For example, while the language docs admonish you not to depend on __del__ running at any particular moment, if we consider the Python/C API a part of the language, then the language has to behave as though it uses naïve reference counting and occasionally runs a cycle collector. And that’s the easy part—think about how deeply the GIL is rooted there.

      That is not good design for something that’s part of the language, as it effectively is. It was never intended to be and never received commensurate amounts of care. It just turned out that way—and ain’t that a sad thing to admit.

      [1] http://hpyproject.org/

    • ihnortonOct 2021

      > I think one could radically change the way Python objects work internally, and have the C foreign function interface (FFI) wrap every object passed to a C extension in an API/ABI-preserving facade

      HPy is building an API abstraction layer which is designed to be used with both the CPython API and JITs. However, IIUC they are not proposing any changes to CPython itself, but rather to provide a smaller API surface and fewer JIT impedance mismatches when extensions are built against something other than CPython. The lead developer is a longtime PyPy developer.

      https://hpyproject.org/ (https://github.com/hpyproject/hpy)

    • antocuniSep 2025

      pypy IS compatible with C extensions, via what we call "cpyext": https://doc.pypy.org/en/latest/faq.html#do-c-extension-modules-work-with-pypy

      The problem of cpyext is that it's super slow, for good reasons: https://pypy.org/posts/2018/09/inside-cpyext-why-emulating-cpython-c-8083064623681286567.html

      There are efforts to create a new C API which is more friendly to alternative implementations (including CPython itself, when they want to change how they do things internally): https://hpyproject.org/ https://github.com/py-ni

    • nneonneoAug 2022

      Absolutely everything in CPython is a PyObject, and that can’t be changed without breaking the C API. A PyObject contains (among other things) a type pointer, a reference count, and a data field; none of these things can be changed without (again) breaking the C API.

      There have definitely been attempts to modernize; the HPy project (https://hpyproject.org/), for instance, moves towards a handle-oriented API that keeps implementation details private and thus enables certain optimizations.

    Related

    PyPy Blogpypy.org183 people

    PyPy has moved to Git, GitHub

    PyPy Blog
    Company · last shared 2026
    Rust Blogblog.rust-lang.org533 people

    Announcing Rust 1.0

    Rust Blog
    Company · last shared 2026
    Chris Wellonsnullprogram.com295 people

    Why Aren't There C Conferences?

    Chris Wellons
    Personal · last shared 2026
    Trevor Jimtrevorjim.com23 people

    Python is not context free (2012)

    Trevor Jim
    Personal · last shared 2024
    Python Software Foundation Blogpyfound.blogspot.com147 people

    PSF has withdrawn $1.5M proposal to US Government grant program

    Python Software Foundation Blog
    Company · last shared 2026
    Jupyter Blogblog.jupyter.org101 people

    JupyterLab is ready for users

    Jupyter Blog
    Company · last shared 2026
    Sourcery Blogsourcery.ai17 people

    How to set up a perfect Python project

    Sourcery Blog
    Company · last shared 2025
    Lambda the Ultimatelambda-the-ultimate.org615 people

    Simon Peyton Jones Elected into the Royal Society Fellowship

    Lambda the Ultimate
    Publication · last shared 2026