Skip to content

Hyperscan for Python

python-hyperscan is an unofficial CPython extension for Intel's Hyperscan, the open source, high-performance multiple regex matching library.

Quickstart

Building Hyperscan

See the official documentation for detailed installation instructions. The following should work for most use cases:

$ git clone https://github.com/intel/hyperscan.git
$ mkdir -p hyperscan/build
$ cd hyperscan/build
$ git checkout v5.1.1
$ cmake \
    -G "Unix Makefiles" \
    -DCMAKE_INSTALL_PREFIX:PATH=/usr \
    -DBUILD_SHARED_LIBS=ON ../
$ # Compile with all available cores:
$ # make -j $(( $(nproc) + 1 ))
$ make
$ sudo make install

Installing python-hyperscan

Installing via pip is recommended:

$ pip install hyperscan

To build and install from source, using Poetry:

$ pip install poetry
$ git clone https://github.com/darvid/python-hyperscan.git
$ cd python-hyperscan
$ poetry install