2020-02-29 17:17:00 +00:00
|
|
|
from setuptools import setup, Extension
|
|
|
|
from setuptools.command.build_ext import build_ext
|
|
|
|
import sys
|
|
|
|
|
2020-03-18 20:34:32 +00:00
|
|
|
from os import path
|
2020-08-22 19:07:08 +00:00
|
|
|
from io import open
|
|
|
|
|
2020-03-18 20:34:32 +00:00
|
|
|
this_dir = path.abspath(path.dirname(__file__))
|
|
|
|
with open(path.join(this_dir, "VERSION"), encoding='utf-8') as version_file:
|
2020-02-29 17:17:00 +00:00
|
|
|
version = version_file.read().strip()
|
|
|
|
|
|
|
|
|
2020-03-18 20:34:32 +00:00
|
|
|
with open(path.join(this_dir, 'README.md'), encoding='utf-8') as f:
|
|
|
|
long_description = f.read()
|
|
|
|
|
2020-02-29 17:17:00 +00:00
|
|
|
class BuildExt(build_ext):
|
|
|
|
"""A custom build extension for adding compiler-specific options."""
|
|
|
|
c_opts = {
|
2020-11-21 17:21:21 +00:00
|
|
|
'msvc': ['/EHsc', '/O2', '/std:c++11'],
|
|
|
|
'unix': ['-O3', '-std=c++11', '-Wextra', '-Wall'],
|
2020-02-29 17:17:00 +00:00
|
|
|
}
|
|
|
|
l_opts = {
|
|
|
|
'msvc': [],
|
|
|
|
'unix': [],
|
|
|
|
}
|
|
|
|
|
|
|
|
if sys.platform == 'darwin':
|
2020-04-03 12:38:34 +00:00
|
|
|
darwin_opts = ['-stdlib=libc++', '-mmacosx-version-min=10.9']
|
2020-02-29 17:17:00 +00:00
|
|
|
c_opts['unix'] += darwin_opts
|
|
|
|
l_opts['unix'] += darwin_opts
|
|
|
|
|
|
|
|
def build_extensions(self):
|
|
|
|
ct = self.compiler.compiler_type
|
|
|
|
opts = self.c_opts.get(ct, [])
|
|
|
|
link_opts = self.l_opts.get(ct, [])
|
|
|
|
if ct == 'unix':
|
|
|
|
opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version())
|
|
|
|
elif ct == 'msvc':
|
|
|
|
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
|
|
|
|
for ext in self.extensions:
|
|
|
|
ext.extra_compile_args = opts
|
|
|
|
ext.extra_link_args = link_opts
|
|
|
|
build_ext.build_extensions(self)
|
|
|
|
|
|
|
|
setup(
|
|
|
|
name='rapidfuzz',
|
|
|
|
version=version,
|
|
|
|
author='Max Bachmann',
|
|
|
|
author_email='contact@maxbachmann.de',
|
2020-04-08 22:12:44 +00:00
|
|
|
url='https://github.com/maxbachmann/rapidfuzz',
|
2020-03-18 20:34:32 +00:00
|
|
|
description='rapid fuzzy string matching',
|
|
|
|
long_description=long_description,
|
|
|
|
long_description_content_type='text/markdown',
|
2020-03-31 17:42:48 +00:00
|
|
|
ext_modules = [
|
2020-04-09 07:21:57 +00:00
|
|
|
Extension(
|
2020-11-08 19:58:42 +00:00
|
|
|
'rapidfuzz.cpp_impl',
|
Release v1.0.0 (#68)
- all normalized string_metrics can now be used as scorer for process.extract/extractOne
- Implementation of the C++ Wrapper completely refactored to make it easier to add more scorers, processors and string matching algorithms in the future.
- increased test coverage, that already helped to fix some bugs and help to prevent regressions in the future
- improved docstrings of functions
- Added bitparallel implementation of the Levenshtein distance for the weights (1,1,1) and (1,1,2).
- Added specialized implementation of the Levenshtein distance for cases with a small maximum edit distance, that is even faster, than the bitparallel implementation.
- Improved performance of `fuzz.partial_ratio`
-> Since `fuzz.ratio` and `fuzz.partial_ratio` are used in most scorers, this improves the overall performance.
- Improved performance of `process.extract` and `process.extractOne`
- the `rapidfuzz.levenshtein` module is now deprecated and will be removed in v2.0.0
These functions are now placed in `rapidfuzz.string_metric`. `distance`, `normalized_distance`, `weighted_distance` and `weighted_normalized_distance` are combined into `levenshtein` and `normalized_levenshtein`.
- added normalized version of the hamming distance in `string_metric.normalized_hamming`
- process.extract_iter as a generator, that yields the similarity of all elements, that have a similarity >= score_cutoff
- multiple bugs in extractOne when used with a scorer, thats not from RapidFuzz
- fixed bug in `token_ratio`
- fixed bug in result normalisation causing zero division
2021-02-12 15:37:44 +00:00
|
|
|
[
|
|
|
|
'src/py_utils.cpp',
|
|
|
|
'src/py_string_metric.cpp',
|
|
|
|
'src/py_fuzz.cpp',
|
|
|
|
'src/py_process.cpp',
|
|
|
|
'src/py_abstraction.cpp'
|
|
|
|
],
|
|
|
|
include_dirs=["src/rapidfuzz-cpp/rapidfuzz", "src/rapidfuzz-cpp/", "extern"],
|
2020-04-09 07:21:57 +00:00
|
|
|
language='c++',
|
|
|
|
),
|
|
|
|
],
|
|
|
|
cmdclass={'build_ext': BuildExt},
|
|
|
|
package_data={'': ['LICENSE', 'VERSION']},
|
2020-04-13 05:43:34 +00:00
|
|
|
package_dir={'': 'src'},
|
2020-04-09 07:21:57 +00:00
|
|
|
packages=['rapidfuzz'],
|
|
|
|
include_package_data=True,
|
2020-02-29 17:17:00 +00:00
|
|
|
zip_safe=False,
|
2020-03-18 20:34:32 +00:00
|
|
|
classifiers=[
|
2020-08-22 19:07:08 +00:00
|
|
|
"Programming Language :: Python :: 2",
|
|
|
|
"Programming Language :: Python :: 2.7",
|
2020-03-18 20:34:32 +00:00
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Programming Language :: Python :: 3.5",
|
|
|
|
"Programming Language :: Python :: 3.6",
|
|
|
|
"Programming Language :: Python :: 3.7",
|
|
|
|
"Programming Language :: Python :: 3.8",
|
2020-08-14 12:08:38 +00:00
|
|
|
"Programming Language :: Python :: 3.9",
|
2020-03-18 20:34:32 +00:00
|
|
|
"License :: OSI Approved :: MIT License",
|
|
|
|
],
|
2020-08-22 19:07:08 +00:00
|
|
|
python_requires=">=2.7",
|
2020-03-31 17:42:48 +00:00
|
|
|
)
|