Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rust rewrite, replaced msufsort with libsais, many bug fixes and perf…
…ormance improvements
- Loading branch information
Gal Ben David
committed
Dec 3, 2021
1 parent
63830bc
commit 9546c6c
Showing
43 changed files
with
8,564 additions
and
15,740 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,49 @@ | ||
name: Build | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
lint: | ||
if: github.event_name == 'push' && !startsWith(github.event.ref, 'refs/tags') | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install latest rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
components: clippy | ||
- name: Lint with clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: --all-targets --all-features | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
needs: lint | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9, pypy3] | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
os: [ubuntu-latest , macos-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Ubuntu packages | ||
run: >- | ||
sudo apt install libidn2-dev; | ||
- name: Run image | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Build Python package | ||
run: poetry run maturin develop | ||
- name: Test | ||
run: >- | ||
python setup.py test | ||
run: poetry run pytest -Werror tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,43 @@ | ||
name: Deploy | ||
on: | ||
release: | ||
types: [published] | ||
|
||
types: [released] | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-20.04 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Build a source tarball | ||
run: >- | ||
python -m pip install --user --upgrade setuptools; | ||
python setup.py sdist; | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
password: ${{ secrets.pypi_password }} | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: messense/maturin-action@v1 | ||
if: runner.os != 'Windows' | ||
with: | ||
maturin-version: latest | ||
command: publish | ||
manylinux: 2_24 | ||
args: --username __token__ --no-sdist --interpreter python${{ matrix.python-version }} | ||
env: | ||
MATURIN_PASSWORD: ${{ secrets.pypi_password }} | ||
- uses: messense/maturin-action@v1 | ||
if: runner.os == 'Windows' | ||
with: | ||
maturin-version: latest | ||
command: publish | ||
manylinux: 2_24 | ||
args: --username __token__ --no-sdist --interpreter python | ||
env: | ||
MATURIN_PASSWORD: ${{ secrets.pypi_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[package] | ||
name = "pysubstringsearch" | ||
version = "0.5.0" | ||
authors = ["Gal Ben David <gal@intsights.com>"] | ||
edition = "2021" | ||
description = "A Python library written in Rust that searches for substrings quickly using a Suffix Array" | ||
readme = "README.md" | ||
repository = "https://github.com/intsights/pysubstringsearch" | ||
homepage = "https://github.com/intsights/pysubstringsearch" | ||
license = "MIT" | ||
keywords = [ | ||
"substring", | ||
"pattern", | ||
"search", | ||
"suffix", | ||
"array", | ||
"rust", | ||
"pyo3" | ||
] | ||
|
||
[package.metadata.maturin] | ||
requires-python = ">=3.6" | ||
classifier = [ | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: MacOS", | ||
"Operating System :: Microsoft", | ||
"Operating System :: POSIX :: Linux", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Rust", | ||
] | ||
|
||
[lib] | ||
name = "pysubstringsearch" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
ahash = "0.7" | ||
bstr = "0.2" | ||
byteorder = "1" | ||
memchr = "2" | ||
parking_lot = "0.11" | ||
rayon = "1" | ||
|
||
[dependencies.pyo3] | ||
version = "0.15.1" | ||
features = ["extension-module"] | ||
|
||
[build-dependencies] | ||
cc = { version = "1.0", features = ["parallel"] } | ||
|
||
[profile.release] | ||
lto = true | ||
panic = "abort" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
fn main() { | ||
println!("cargo:rerun-if-changed=libsais.c"); | ||
|
||
let src = [ | ||
"src/libsais/libsais.c", | ||
]; | ||
let mut builder = cc::Build::new(); | ||
let build = builder | ||
.files(src.iter()); | ||
build.compile("libsais"); | ||
} |
Oops, something went wrong.