- Home
- Code Transpilers
- Cython
Cython
What it is
Cython is a free static compiler for Python and the extended Cython language, used to create C extensions for Python. It translates source code into C or C++ that can be compiled as Python extension modules. Optional static type declarations can help generate more efficient C code, and declared C or C++ types let Python code call existing C or C++ code. Cython also supports source-level debugging across Python, Cython, and C. The project describes uses including wrapping external C libraries, embedding CPython in existing applications, and speeding up Python code with fast C modules. It can work with multidimensional NumPy arrays and integrate with low-level libraries and applications. Installation is available through pip, and some scientific Python distributions include Cython. A C compiler is required; guidance covers Linux, macOS, and Windows. The project describes generated-code compatibility with major C and C++ compilers for CPython 3.8 and later, and characterizes PyPy support as mostly usable. Limited API and free-threading support in Cython 3.1 are experimental.
For and against
For
- Generates C or C++ extension-module source.
- Supports line, branch, and method coverage.
Against
- A C compiler is required.
- Limited API and free-threading support are experimental.
The verdict
Cython connects Python code with compiled C and C++ workflows, with optional types and source-level debugging. Building its generated code requires a C compiler.
Who it suits
It suits Python developers who need C extensions, connections to C or C++ libraries, or compiled modules for performance-focused work.
Plans and prices
Cython
Freely available under the open source Apache 2.0 License
Read 30 Sep 2026 · cython.org
On the record
- Build requirement
- Cython requires a C compiler; the installation guide gives compiler guidance for Linux, macOS and Windows.docs.cython.org · read 30 Sep 2026
- C and C++
- Cython lets Python code call C or C++ code and supports declaring C or C++ types.cython.org · read 30 Sep 2026
- Data and libraries
- The project describes using Cython with multidimensional NumPy arrays and integrating with existing low-level libraries and applications.cython.org · read 30 Sep 2026
- Debugging
- Cython supports combined source-level debugging across Python, Cython and C code.cython.org · read 30 Sep 2026
- Experimental support
- The homepage says support for the CPython Limited API and free-threading CPython is available in Cython 3.1 but considered experimental.cython.org · read 30 Sep 2026
- Generated code
- Cython translates source code into C or C++ code that can be compiled as Python extension modules.docs.cython.org · read 30 Sep 2026
- Installation
- The documentation recommends installing Cython with pip and says some scientific Python distributions, including Anaconda and Sage, bundle it.docs.cython.org · read 30 Sep 2026
- Intended use
- The project identifies wrapping external C libraries, embedding CPython in existing applications and speeding up Python code with fast C modules as use cases.cython.org · read 30 Sep 2026
- Python compatibility
- The homepage says generated code compiles with major C and C++ compilers for CPython 3.8 and later, and describes PyPy support as mostly usable.cython.org · read 30 Sep 2026
- Static typing
- Optional static type declarations can help generate more efficient C code from Python-like code.docs.cython.org · read 30 Sep 2026
- Support channels
- The homepage directs users with questions to the Cython users mailing list and links a separate core developer mailing list.cython.org · read 30 Sep 2026
- What it does
- Cython is an optimising static compiler for Python and the extended Cython language, used to write C extensions for Python.cython.org · read 30 Sep 2026