Scroll to navigation

CYTHONIZE(1) User Commands CYTHONIZE(1)

NAME

cythonize - compile Cython code (.pyx) into C to build a Python extension

DESCRIPTION

usage: cythonize [-h] [-X NAME=VALUE,...] [-E NAME=VALUE,...] [-s NAME=VALUE]

[-2] [-3] [--3str] [-+] [-a] [--annotate-fullc] [-x PATTERN] [-b] [-i] [--timeit CODESTRING] [--setup CODESTRING] [-j N] [-f] [-q] [--lenient] [-k] [--no-docstrings] [-M] [sources ...]

positional arguments:

sources

options:

show this help message and exit
set a compiler directive
set a compile time environment variable
set a cythonize option
-2
use Python 2 syntax mode by default
-3
use Python 3 syntax mode by default
--3str
use Python 3 syntax mode by default (deprecated alias for -3)
-+, --cplus
Compile as C++ rather than C
Produce a colorized HTML version of the source.
Produce a colorized HTML version of the source which includes entire generated C/C++-code.
exclude certain file patterns from the compilation
build extension modules using distutils/setuptools
build extension modules in place using distutils/setuptools (implies -b)
build in place, then compile+run CODESTRING as benchmark in first module's namespace (implies -i)
use CODESTRING as pre-benchmark setup code for --bench
run builds in N parallel jobs (default: 9)
force recompilation
be less verbose during compilation
increase Python compatibility by ignoring some compile time errors
compile as much as possible, ignore compilation failures
strip docstrings
produce depfiles for the sources

Environment variables:

CYTHON_FORCE_REGEN: if set to 1, forces cythonize to regenerate the output files regardless
of modification times and changes.
CYTHON_CACHE_DIR: the base directory containing Cython's caches. Environment variables accepted by setuptools are supported to configure the C compiler and build: https://setuptools.pypa.io/en/latest/userguide/ext_modules.html#compiler-and-linker-options
October 2025 Cython 3.1.6