CYTHON(1)

πŸ“¦
version 3.1.6 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

✨ CYTHON(1) ✨

okay bestie, sit DOWN, because this is the manual page for cython from User Commands and it's literally the moment your .pyx files get their glow-up πŸ’…


🌸 NAME 🌸

cython β€” compile Cython code (.pyx) into C so you can build a Python extension πŸβž‘οΈπŸ‡¨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, here's the vibe. The usage line goes like this, exactly:

cython [-h] [-V] [-l] [-I INCLUDE_PATH] [-o OUTPUT_FILE] [-t]
       [-f] [-v]

       [-p] [--cleanup GENERATE_CLEANUP_CODE] [--cache] [-w
       WORKING_PATH] [--gdb] [--gdb-outdir GDB_OUTDIR] [-D] [-a]
       [--annotate-fullc] [--annotate-coverage ANNOTATE_COVERAGE_XML]
       [--line-directives] [-+] [--embed] [-2] [-3] [--3str] [--lenient]
       [--capi-reexport-cincludes] [--fast-fail] [-Werror] [-Wextra] [-X
       NAME=VALUE,...] [-E NAME=VALUE,...]  [--module-name MODULE_NAME]
       [-M] [--generate-shared SHARED_C_FILE_PATH] [--shared
       SHARED_UTILITY_QUALIFIED_NAME] [sources ...]

So what even IS this? Cython (https://cython.org/) is a compiler for code written in the Cython language. That's the whole thing. And plot twist: Cython is based on Pyrex by Greg Ewing 🫢 (shoutout to the ancestors, no cap).

πŸ‘‘ positional arguments:

  • sources β€” the files you're feeding in, bestie. That's it, that's the list.

πŸ’– options:

  • -h, --help β€” shows this help message and dips. classic.
  • -V, --version β€” Display version number of cython compiler ✨
  • -l, --create-listing β€” Write error messages to a listing file πŸ“ (so you can read your mistakes in style)
  • -I, --include-dir INCLUDE_PATH β€” Search for include files in named directory. and yes, you can stack them β€” multiple include directories are allowed πŸŽ€
  • -o, --output-file OUTPUT_FILE β€” Specify name of generated C file
  • -t, --timestamps β€” Only compile newer source files (lazy-girl efficiency, we love her)
  • -f, --force β€” Compile all source files, and it overrides implied -t πŸ’€ no skipping allowed
  • -v, --verbose β€” Be verbose, print file names on multiple compilation πŸ—£οΈ
  • -p, --embed-positions β€” If specified, the positions in Cython files of each function definition is embedded in its docstring.
  • --cleanup GENERATE_CLEANUP_CODE β€” Release interned objects on python exit, for memory debugging. Level indicates aggressiveness, default 0 releases nothing.
  • --cache β€” Enables Cython compilation cache. ⚑ (she remembers things so you don't have to)
  • -w, --working WORKING_PATH β€” Sets the working directory for Cython (the directory modules are searched from)
  • --gdb β€” Output debug information for cygdb πŸ›
  • --gdb-outdir GDB_OUTDIR β€” Specify gdb debug information output directory. Implies --gdb. (sneaky little chain reaction, iykyk)
  • -D, --no-docstrings β€” Strip docstrings from the compiled module. bye bye little comments 😭
  • -a, --annotate β€” Produce a colorized HTML version of the source. 🌈 pretty AND useful
  • --annotate-fullc β€” Produce a colorized HTML version of the source which includes entire generated C/C++-code.
  • --annotate-coverage ANNOTATE_COVERAGE_XML β€” Annotate and include coverage information from cov.xml.
  • --line-directives β€” Produce #line directives pointing to the .pyx source
  • -+, --cplus β€” Output a C++ rather than C file. ✨C++ girlies rise✨
  • --embed β€” Generate a main() function that embeds the Python interpreter. Pass --embed=<method_name> for a name other than main().
  • -2 β€” Compile based on Python-2 syntax and code semantics.
  • -3 β€” Compile based on Python-3 syntax and code semantics.
  • --3str β€” Compile based on Python-3 syntax and code semantics (same as -3 since Cython 3.1).
  • --lenient β€” Change some compile time errors to runtime errors to improve Python compatibility 🫢 (she's being nice to you)
  • --capi-reexport-cincludes β€” Add cincluded headers to any auto-generated header files.
  • --fast-fail β€” Abort the compilation on the first error. no second chances, periodt πŸ’€
  • -Werror, --warning-errors β€” Make all warnings into errors. every warning is now a jumpscare πŸ™ˆ
  • -Wextra, --warning-extra β€” Enable extra warnings.
  • -X, --directive NAME=VALUE,... β€” Overrides a compiler directive
  • -E, --compile-time-env NAME=VALUE,... β€” Provides compile time env like DEF would do.
  • --module-name MODULE_NAME β€” Fully qualified module name. If not given, is deduced from the import path if source file is in a package, or equals the filename otherwise.
  • -M, --depfile β€” produce depfiles for the sources
  • --generate-shared SHARED_C_FILE_PATH β€” Generates shared module with specified name.
  • --shared SHARED_UTILITY_QUALIFIED_NAME β€” Imports utility code from shared module specified by fully qualified module name.

🧚 Environment variables:

  • CYTHON_CACHE_DIR β€” the base directory containing Cython's caches. πŸŽ€ that's the one, bestie, that's the whole list.

real talk for one sec: this page is from Cython 3.1.6, dated March 2026, and it's filed under CYTHON(1) in the User Commands section. go forth and compile, my love πŸ’œπŸ¦‹βœ¨
πŸ“¦ where this page comes from