skillfed

pythran

Ahead of Time compiler for numeric kernels

pythran v0.18.1 854.4K downloads/30d#4,895 on PyPI2,141
License unclear 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) Active released

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 pythran

uv

uv add pythran

poetry

poetry add pythran

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: MacOSOperating System :: POSIX :: LinuxProgramming Language :: C++Programming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Compilers

Tags

python to native code compilerscientific python optimizationahead of time compilationnumpy accelerationpython performance compiler
scientific-computingperformance-optimizationjit-compilation

More Code Generators packages