Skip to main content

lightweight wrapper around basic LLVM functionality

Project description

Azure Pipelines Code Climate Coveralls.io Readthedocs.io

A Lightweight LLVM Python Binding for Writing JIT Compilers

llvmlite is a project originally tailored for Numba’s needs, using the following approach:

  • A small C wrapper around the parts of the LLVM C++ API we need that are not already exposed by the LLVM C API.

  • A ctypes Python wrapper around the C API.

  • A pure Python implementation of the subset of the LLVM IR builder that we need for Numba.

Why llvmlite

The old llvmpy binding exposes a lot of LLVM APIs but the mapping of C++-style memory management to Python is error prone. Numba and many JIT compilers do not need a full LLVM API. Only the IR builder, optimizer, and JIT compiler APIs are necessary.

Key Benefits

  • The IR builder is pure Python code and decoupled from LLVM’s frequently-changing C++ APIs.

  • Materializing a LLVM module calls LLVM’s IR parser which provides better error messages than step-by-step IR building through the C++ API (no more segfaults or process aborts).

  • Most of llvmlite uses the LLVM C API which is small but very stable (low maintenance when changing LLVM version).

  • The binding is not a Python C-extension, but a plain DLL accessed using ctypes (no need to wrestle with Python’s compiler requirements and C++ 11 compatibility).

  • The Python binding layer has sane memory management.

  • llvmlite is quite faster than llvmpy’s thanks to a much simpler architeture (the Numba test suite is twice faster than it was).

llvmpy Compatibility Layer

The llvmlite.llvmpy namespace provides a minimal llvmpy compatibility layer.

Compatibility

llvmlite works with Python 3.7 and greater.

As of version 0.37.0, llvmlite requires LLVM 11.x.x on all architectures

Historical compatibility table:

llvmlite versions

compatible LLVM versions

0.37.0 - …

11.x.x

0.34.0 - 0.36.0

10.0.x (9.0.x for aarch64 only)

0.33.0

9.0.x

0.29.0 - 0.32.0

7.0.x, 7.1.x, 8.0.x

0.27.0 - 0.28.0

7.0.x

0.23.0 - 0.26.0

6.0.x

0.21.0 - 0.22.0

5.0.x

0.17.0 - 0.20.0

4.0.x

0.16.0 - 0.17.0

3.9.x

0.13.0 - 0.15.0

3.8.x

0.9.0 - 0.12.1

3.7.x

0.6.0 - 0.8.0

3.6.x

0.1.0 - 0.5.1

3.5.x

Documentation

You’ll find the documentation at http://llvmlite.pydata.org

Pre-built binaries

We recommend you use the binaries provided by the Numba team for the Conda package manager. You can find them in Numba’s anaconda.org channel. For example:

$ conda install --channel=numba llvmlite

(or, simply, the official llvmlite package provided in the Anaconda distribution)

Other build methods

If you don’t want to use our pre-built packages, you can compile and install llvmlite yourself. The documentation will teach you how: http://llvmlite.pydata.org/en/latest/install/index.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llvmlite-0.39.1.tar.gz (132.8 kB view hashes)

Uploaded Source

Built Distributions

llvmlite-0.39.1-cp310-cp310-win_amd64.whl (23.2 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

llvmlite-0.39.1-cp310-cp310-win32.whl (19.1 MB view hashes)

Uploaded CPython 3.10 Windows x86

llvmlite-0.39.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

llvmlite-0.39.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (37.5 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

llvmlite-0.39.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (33.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

llvmlite-0.39.1-cp310-cp310-macosx_11_0_arm64.whl (23.1 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

llvmlite-0.39.1-cp310-cp310-macosx_10_9_x86_64.whl (25.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

llvmlite-0.39.1-cp39-cp39-win_amd64.whl (23.2 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

llvmlite-0.39.1-cp39-cp39-win32.whl (19.1 MB view hashes)

Uploaded CPython 3.9 Windows x86

llvmlite-0.39.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

llvmlite-0.39.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (37.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

llvmlite-0.39.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (33.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

llvmlite-0.39.1-cp39-cp39-macosx_11_0_arm64.whl (23.1 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

llvmlite-0.39.1-cp39-cp39-macosx_10_9_x86_64.whl (25.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

llvmlite-0.39.1-cp38-cp38-win_amd64.whl (23.2 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

llvmlite-0.39.1-cp38-cp38-win32.whl (19.1 MB view hashes)

Uploaded CPython 3.8 Windows x86

llvmlite-0.39.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.6 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

llvmlite-0.39.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (37.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

llvmlite-0.39.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (33.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

llvmlite-0.39.1-cp38-cp38-macosx_11_0_arm64.whl (23.1 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

llvmlite-0.39.1-cp38-cp38-macosx_10_9_x86_64.whl (25.5 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

llvmlite-0.39.1-cp37-cp37m-win_amd64.whl (23.2 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

llvmlite-0.39.1-cp37-cp37m-win32.whl (19.1 MB view hashes)

Uploaded CPython 3.7m Windows x86

llvmlite-0.39.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.6 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

llvmlite-0.39.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (37.5 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

llvmlite-0.39.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (33.8 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

llvmlite-0.39.1-cp37-cp37m-macosx_10_9_x86_64.whl (25.5 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page