Codon compiles Python to native machine code with large speedups over CPython on a single thread. It supports multithreading without a GIL, GPU kernels, and a compiled NumPy implementation.
Overview
Codon is a statically compiled Python implementation aimed at numerical and performance-critical workloads. It keeps much of Python syntax and semantics but rejects some dynamic patterns unsuitable for ahead-of-time compilation. Programs run via codon run, build to executables with codon build, and can emit LLVM IR for inspection.
Parallelism uses OpenMP annotations for multithreaded loops and optional GPU execution, including Mandelbrot-style kernel examples. A built-in NumPy reimplementation mirrors the familiar API with compiler optimizations such as fusion and allocation elision. Python interoperability imports existing packages through a dedicated bridge when configured with the CPython shared library.
Codon is not a drop-in CPython replacement; teams can embed it via JIT decorators, extension modules, or hybrid codebases. Binaries target Linux, macOS, and Windows on x86-64 with install scripts documented for PATH and toolchain setup.
Key features
- Python compiled to native binaries
- Native multithreading without GIL
- OpenMP parallel loops
- GPU kernel compilation
- Compiled NumPy-compatible arrays
- LLVM-based code generation
- CPython library interoperability
- JIT and extension integration paths
Use cases
- Accelerated numerical Python
- Standalone native executables
- Multicore scientific computing
- GPU data processing kernels
- Hot-path JIT inside Python apps