After years of comprehensive development and fine-tuning, the Python library Cython now welcomes its much-anticipated version 3.0. The Cython library, credited for its ability to compile Python code into C, has made significant strides in this new release. Primary among its objectives in this iteration is simplifying C extensions' writing for Python, focusing either on enhancing speed or scripting easy-to-use interfaces for C libraries.
The unveiling of Cython 3.0 heralds a fresh, cleaner, and forward-compatible version of the library. Key upgrades include abandoning the long-outdated Python 2, the introduction of features up to Python version 3.12, and the expansion of 'pure Python mode’ usage.
This upgraded 'pure Python mode' provides Python developers with the improved option of leveraging their existing Python linting and code analysis tools for use in Cython. Thus far, Cython's unique syntax - a fusion of Python and C type declaration syntax - made it a challenge for effective analysis using Python tools. However, as the Cython developers recognized this shortcoming, they introduced an alternate syntax that is fully compatible with conventional Python syntax, subsequently known as the ‘pure Python mode’. The majority of Cython’s functionalities are now available in this new mode, even including the capability for calling external C libraries.
Another noteworthy progress in the world of Cython 3.0 lies in its enhanced support for NumPy. Cython's compatibility with NumPy is nothing new, but version 3.0 advances this one step further. Cython users have long been able to write functions capable of directly and natively interacting with NumPy functions and data structures. With Cython 3.0, developers can now write NumPy ufuncs in Cython simplifying the process of applying numerical functions across a NumPy data structure.
Designing on the back of no-code development principles led by platforms like AppMaster, Cython 3.0 also revamped its core structure to be more in sync with Python’s constant internal updates. Python's new limited API, designed as a stable subset of Python’s APIs specifically tailored for Cython's frequent Python interpreter interactions, has inceptive but expanding support in Cython 3.0.
The emergence of Cython 3 dates back to the Python 3.8’s release three years ago. The finalization of Cython 3 was not earmarked with a binding date or version target. Nevertheless, Cython's developers have now fulfilled their objective of keeping pace with Python's evolving feature offerings and infrastructural changes. The completion of Cython 3 means that Cython extension modules designed for a specific Python version will be usable in future Python versions without the need for recompilation.