pythran
Ahead of Time compiler for numeric kernels
What it is and what it does
Pythran is an ahead-of-time compiler for a subset of Python, designed to accelerate scientific computing code. You write Python functions with type annotations (via special comments), run the Pythran compiler on your module, and get back a native Python extension that drops in as a replacement. It leverages multi-core and SIMD capabilities to speed up numeric kernels.
The package depends on numpy, gast (for AST manipulation), beniget (for scope analysis), ply (for parsing), and setuptools. It requires Python 3.7 or later and a C++ compiler plus BLAS libraries on your system. The project is actively maintained and is used in scientific Python workflows where pure Python or even NumPy alone is too slow.
Use it for:
- Accelerate tight numeric loops in scientific simulations without rewriting in C or Cython.
- Compile array-heavy functions that use NumPy operations into native code for multi-core execution.
- Optimize linear algebra and matrix operations by leveraging SIMD and BLAS libraries.
- Speed up data processing pipelines in research code where Python is the primary language.
- Parallelize embarrassingly parallel numeric kernels across CPU cores automatically.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pythran is an ahead-of-time compiler that converts annotated Python functions into optimized native code, targeting scientific computing workloads with support for multi-core and SIMD execution.
Yes, if you have scientific Python code with numeric bottlenecks and are willing to annotate function signatures. The package is actively maintained, has low install friction, and requires only standard dependencies. The main gotcha is platform-specific setup (C++ compiler and BLAS libraries); verify those are available before installing. The unclear license treatment warrants a quick review of your project's compliance requirements.
Install
pythran on PyPI
pip
pip install pythranuv
uv add pythranpoetry
poetry add pythranInstalling pythran
Before you install
Low install friction with a pure-wheel distribution. The package is actively maintained with a recent release and an active repository. Runtime dependencies are all well-established Python packages (ply, setuptools, gast, numpy, beniget), though system-level C++ compilation tools and BLAS libraries may be required depending on your platform.
License in practice
License treatment is unclear—the package uses a BSD-style license, but the SPDX identifier is not formally declared. Verify the exact terms apply to your use case before depending on it in proprietary or restricted-license projects.
Quickstart
pip install pythran
# Annotate a Python module with type hints:
# #pythran export dprod(int list, int list)
# def dprod(l0, l1):
# return sum(x * y for x, y in zip(l0, l1))
# Compile to native module:
# pythran dprod.py
# Then import the compiled result as a normal Python module
Requires Python 3.7 or later. Platform-specific C++ compiler and BLAS library (libatlas, openblas, etc.) must be installed separately; see platform-specific installation notes in documentation.
Verify before relying
- Whether the BSD-style license in license_raw is formally equivalent to a standard SPDX identifier and what that means for your project's compliance.
- Performance gains on your specific workload—Pythran targets scientific computing but actual speedup depends on code patterns and hardware.
Package facts
| License | Copyright (c) 2012, HPC Project and Serge Guelton All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following… (full text in the JSON record) (unclear) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — ply, setuptools, gast, numpy, beniget |
| Maintenance | actively maintained — 272 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 854,351/month — #4,895 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pythran-0.18.1-py3-none-any.whl
Tags
More Code Generators packages
Proto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
beartypeBeartype is a runtime type checker that…
permissive · top 1,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
astorastor converts Python abstract syntax trees…
permissive · top 5,000 on PyPI
NuitkaNuitka compiles Python code to C and then to…
agpl · top 15,000 on PyPI
nvidia-cuda-nvrtcProvides NVIDIA CUDA NVRTC (NVIDIA Runtime…
unclear · top 1,000 on PyPI
meson-pythonmeson-python is a PEP 517 build backend that…
permissive · top 5,000 on PyPI
numpy-minmaxFinds the minimum and maximum values in a NumPy…
permissive · top 15,000 on PyPI
nvidia-cuda-nvccProvides the NVIDIA CUDA nvcc compiler for…
unclear · top 5,000 on PyPI
numbaNumba is a just-in-time compiler that…
permissive · top 1,000 on PyPI
SConsSCons is a Python-based build system that…
permissive · top 5,000 on PyPI
memrayMemray is a memory profiler for Python that…
permissive · top 5,000 on PyPI
librtProvides efficient C-based runtime utilities…
permissive · top 1,000 on PyPI
ManimPangoManimPango is a C binding for Pango using…
permissive · top 15,000 on PyPI