Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbachmann committed Jan 8, 2022
0 parents commit e33fb4b
Show file tree
Hide file tree
Showing 29 changed files with 2,980 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: maxbachmann
38 changes: 38 additions & 0 deletions .github/workflows/branchbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

on:
push:
branches-ignore:
- main

jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.6", "3.9", "3.10"]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: "actions/checkout@v2"
with:
submodules: 'true'
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest hypothesis pandas
- name: build
run: |
pip install build; python -m build --sdist
# test whether tarball contains all files required for compiling
pip install dist/jarowinkler-*.tar.gz
- name: Test with pytest
run: |
pytest tests
175 changes: 175 additions & 0 deletions .github/workflows/releasebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: Build

on:
push:
branches:
- main
release:
types:
- published

jobs:
build_wheels_windows:
name: Build wheel on ${{ matrix.os }}/auto/${{matrix.python_tag}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python_tag: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "pp37-*", "pp38-*"]
os: [windows-latest]
env:
CIBW_BUILD: ${{matrix.python_tag}}
CIBW_TEST_REQUIRES: pytest hypothesis pandas
CIBW_TEST_COMMAND: pytest {package}/tests
CIBW_BUILD_VERBOSITY: 3

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

- uses: actions/setup-python@v2

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

build_wheels_macos:
name: Build wheel on ${{ matrix.os }}/auto/${{matrix.python_tag}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python_tag: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "pp37-*", "pp38-*"]
os: [macos-latest]
env:
CIBW_BUILD: ${{matrix.python_tag}}
CIBW_TEST_REQUIRES: pytest hypothesis pandas
CIBW_TEST_COMMAND: pytest {package}/tests
CIBW_BUILD_VERBOSITY: 3

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

- uses: actions/setup-python@v2

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

build_wheels_apple_silicon:
name: Build wheel on macos-latest/universal2+arm64/${{matrix.python_tag}}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python_tag: ["cp38-*", "cp39-*", "cp310-*"]
env:
CIBW_BUILD: ${{matrix.python_tag}}
CIBW_ARCHS_MACOS: "universal2 arm64"
CIBW_BUILD_VERBOSITY: 3

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

- uses: actions/setup-python@v2

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

build_wheels_manylinux:
name: Build wheels on ubuntu-latest/${{matrix.arch}}/${{matrix.python_tag}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [auto, aarch64, ppc64le, s390x]
python_tag: [ "cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*", "pp37-*", "pp38-*"]
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_BUILD: ${{matrix.python_tag}}
CIBW_TEST_SKIP: "*-manylinux_{aarch64,ppc64le,s390x}"
CIBW_TEST_REQUIRES: pytest hypothesis pandas
CIBW_TEST_COMMAND: pytest {package}/tests
CIBW_BUILD_VERBOSITY: 3

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

- uses: actions/setup-python@v2

- uses: docker/setup-qemu-action@v1
name: Set up QEMU

- name: Build wheel
uses: pypa/[email protected]
with:
output-dir: wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

- uses: actions/setup-python@v2

- name: Build sdist
run: |
pip3 install build; python3 -m build --sdist
# test whether tarball contains all files required for compiling
pip3 install dist/jarowinkler-*.tar.gz
pip3 uninstall jarowinkler --yes
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

deploy-wheels:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [build_wheels_windows, build_wheels_macos, build_wheels_apple_silicon, build_wheels_manylinux, build_sdist]
name: deploy wheels to pypi
runs-on: ubuntu-18.04

steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.vscode/
__pycache__/
.idea/
build/
_skbuild/
rapidfuzz.egg-info/
dist/
*.data
*.so
*.o
*.out
test.py
src/*.html
.coverage
coverage.xml

# Sphinx documentation
site/

# benchmark results
bench_results/

# Hypothesis results
.hypothesis/

# Cython
src/*.cpp

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "extern/jarowinkler-cpp"]
path = extern/jarowinkler-cpp
url = ../../maxbachmann/jarowinkler-cpp
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Changelog

18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.12.0)

cmake_policy(SET CMP0054 NEW)

set(THREADS_PREFER_PTHREAD_FLAG ON)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
endif()

project(rapidfuzz LANGUAGES C CXX)

find_package(PythonExtensions REQUIRED)
find_package(Python COMPONENTS Interpreter Development)
find_package(Cython REQUIRED)

set(JAROWINKLER_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

add_subdirectory(src/cython)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright © 2020 maxbachmann
Copyright © 2011 Adam Cohen

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 changes: 15 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include setup.py
include CMakeLists.txt
include README.md
include LICENSE
include pyproject.toml
include src/rapidfuzz/**/*.pyi
include src/rapidfuzz/py.typed

recursive-include src/cython CMakeLists.txt
recursive-include src/cython *.hpp
recursive-include src/cython *.pyx
recursive-include src/cython *.pxd

include extern/jarowinkler-cpp/LICENSE
recursive-include extern/jarowinkler-cpp/jaro_winkler *.hpp
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## JaroWinkler


## Description

## Requirements

- Python 3.6 or later
- On Windows the [Visual C++ 2019 redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) is required

## Installation

There are several ways to install JaroWinkler, the recommended methods
are to either use `pip`(the Python package manager) or
`conda` (an open-source, cross-platform, package manager)

### with pip

JaroWinkler can be installed with `pip` the following way:

```bash
pip install jarowinkler
```

There are pre-built binaries (wheels) of JaroWinkler for MacOS (10.9 and later), Linux x86_64 and Windows.

> :heavy_multiplication_x:   **failure "ImportError: DLL load failed"**
>
> If you run into this error on Windows the reason is most likely, that the [Visual C++ 2019 redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) is not installed, which is required to find C++ Libraries (The C++ 2019 version includes the 2015, 2017 and 2019 version).
### with conda

RapidFuzz can be installed with `conda`:

```bash
conda install -c conda-forge jarowinkler
```

### from git
JaroWInkler can be installed directly from the source distribution by cloning the repository. This requires a C++14 capable compiler.

```bash
git clone --recursive https://github.com/maxbachmann/JaroWinkler.git
cd JaroWinkler
pip install .
```

## Usage

## Benchmark
Loading

0 comments on commit e33fb4b

Please sign in to comment.