I’d like to submit an abstract for a short presentation at PyConFr. Since the subject is a bit complex, I thought I could ask feedback from people here.
The title would be Universal Python extensions: performance, compatibility, sustainability, and less CO₂.
and the text:
Python’s long-term relevance for numerical computing faces a long-term threat, not from
external competition alone, but from fundamental architectural decisions that prevent the
entire ecosystem from achieving better performance. While PyPy and GraalPy can make pure
Python code 4x faster than CPython, they face an existential crisis: the moment you
import NumPy or any package with C extensions, that performance advantage disappears
completely.
This isn’t just a technical curiosity. It’s putting alternative Python implementations in
genuine danger of end-of-life status.
The hard truth about Python’s performance future
The compatibility trap: Python’s C extension system creates an insurmountable barrier
between implementations. Popular packages like NumPy, Pandas, and scikit-learn are locked
into CPython-specific APIs, making faster interpreters effectively unusable for
real-world numerical work. Worse, the current C API also constrains CPython itself,
preventing future performance improvements that would break existing extensions.
HPy: promise and reality: The HPy project aimed to solve this with a universal C API,
showing impressive preliminary results with extensions that work across CPython, PyPy,
and GraalPy. However, the project has stalled without sufficient corporate and community
support, a critical opportunity slipping away.
The limited API alternative: CPython’s limited C API offers another path, but with
significant constraints and unclear long-term viability for the ecosystem’s needs.
What this talk proposes
Rather than accepting this situation, we need coordinated community action. This talk
argues for:
-
Community recognition: The Python community must acknowledge these performance
limitations as a serious long-term challenge, not just a nice-to-have improvement. -
Official support: A PEP process to formalize the need for universal C API solutions
compatible with JIT Python compilers, with a dedicated working group to study possible
solutions and coordinate actions across different ecosystem actors.
Why we need to act now
The stakes extend far beyond technical performance. Enabling more efficient Python
interpreters would have two transformative effects:
-
More Python: Performance-sensitive code could be written in pure Python with
object-oriented patterns and small objects, rather than requiring native extensions,
simplifying development and deployment. -
Environmental impact: Given Python’s massive global usage, significant performance
improvements would translate to measurable CO2 emission reductions across millions of
applications worldwide.
Without community mobilization, we risk losing both alternative Python implementations
and Python’s competitive position in performance-critical domains. The technical
foundations exist but need coordinated effort to become reality.
Target Audience
This talk is for Python developers who care about the ecosystem’s long-term health.
Whether you’re a package maintainer or concerned user, you’ll understand the stakes and
learn how to contribute to solutions.
Come prepared to discuss hard truths about Python’s future and leave with concrete
actions for community engagement.
Of course, it’s quite short so there are some partly inexact statements. My goal with this potential presentation is to trigger discussions. For example, I’d like to better understand what can be done on this subject with the limited API.
Anyway, feedback would be appreciated.