From 13561ccca679896246b57c1181b214b702b8b189 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 1 Aug 2024 22:48:14 +0200 Subject: [PATCH 01/19] port to scikit-build-core --- CMakeLists.txt | 2 +- MANIFEST.in | 30 ------------ _custom_build/backend.py | 98 ---------------------------------------- pyproject.toml | 77 +++++++++++++++++++++++++++++-- 4 files changed, 74 insertions(+), 133 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 _custom_build/backend.py diff --git a/CMakeLists.txt b/CMakeLists.txt index d6466e6c..a734f181 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12...3.29) +cmake_minimum_required(VERSION 3.15...3.30) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 211ea2bc..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,30 +0,0 @@ -include MANIFEST.in -include setup.py -include CHANGELOG.rst -include CMakeLists.txt -include README.md -include LICENSE -include pyproject.toml -include _custom_build/backend.py -include src/rapidfuzz/py.typed -recursive-include src/rapidfuzz *.pyi - -recursive-include src/rapidfuzz CMakeLists.txt -recursive-include cmake * -recursive-include src/rapidfuzz *.hpp *.h *.cpp *.cxx *.pyx *.pxd -recursive-include tests * -recursive-include docs * -include src/rapidfuzz/__init__.pxd -include src/rapidfuzz/rapidfuzz.h - -include extern/rapidfuzz-cpp/LICENSE -include extern/rapidfuzz-cpp/CMakeLists.txt -recursive-include extern/rapidfuzz-cpp/rapidfuzz *.hpp *.impl - -include extern/taskflow/LICENSE -include extern/taskflow/CMakeLists.txt -include extern/taskflow/TaskflowConfig.cmake.in -include extern/taskflow/taskflow/algorithm/* -include extern/taskflow/taskflow/core/* -include extern/taskflow/taskflow/utility/* -include extern/taskflow/taskflow/taskflow.hpp diff --git a/_custom_build/backend.py b/_custom_build/backend.py deleted file mode 100644 index 1212afe3..00000000 --- a/_custom_build/backend.py +++ /dev/null @@ -1,98 +0,0 @@ -from __future__ import annotations - -import platform as _platform -import subprocess as _subprocess - -from packaging import version as _version -from packaging.tags import sys_tags as _sys_tags -from setuptools import build_meta as _orig -from skbuild.cmaker import get_cmake_version as _get_cmake_version -from skbuild.exceptions import SKBuildError as _SKBuildError - -prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel -build_wheel = _orig.build_wheel -build_sdist = _orig.build_sdist -get_requires_for_build_sdist = _orig.get_requires_for_build_sdist - -cmake_wheels = { - "win_amd64", - "win_arm64", - "win32", - "musllinux_1_1_x86_64", - "musllinux_1_1_s390x", - "musllinux_1_1_ppc64le", - "musllinux_1_1_i686", - "musllinux_1_1_aarch64", - "manylinux_2_17_s390x", - "manylinux_2_17_ppc64le", - "manylinux_2_17_aarch64", - "manylinux_2_17_x86_64", - "manylinux_2_17_i686", - "manylinux_2_12_x86_64", - "manylinux_2_12_i686", - "macosx_10_10_universal2", -} - -ninja_wheels = { - "win_amd64", - "win_arm64", - "win32", - "musllinux_1_1_x86_64", - "musllinux_1_1_s390x", - "musllinux_1_1_ppc64le", - "musllinux_1_1_i686", - "musllinux_1_1_aarch64", - "manylinux_2_17_s390x", - "manylinux_2_17_ppc64le", - "manylinux_2_17_aarch64", - "manylinux_2_5_x86_64", - "manylinux_2_5_i686", - "macosx_10_9_universal2", -} - - -def _cmake_required(): - try: - if _version.parse(_get_cmake_version().split("-")[0]) >= _version.parse("3.12"): - print("Using System version of cmake") - return False - except _SKBuildError: - pass - - for tag in _sys_tags(): - if tag.platform in cmake_wheels: - return True - - print("No cmake wheel available on platform") - return False - - -def _ninja_required(): - if _platform.system() == "Windows": - print("Ninja is part of the MSVC installation on Windows") - return False - - for generator in ("ninja", "make"): - try: - _subprocess.check_output([generator, "--version"]) - print(f"Using System version of {generator}") - return False - except (OSError, _subprocess.CalledProcessError): - pass - - for tag in _sys_tags(): - if tag.platform in ninja_wheels: - return True - - print("No Ninja wheel available on platform") - return False - - -def get_requires_for_build_wheel(config_settings=None): - packages = [] - if _cmake_required(): - packages.append("cmake") - if _ninja_required(): - packages.append("ninja") - - return _orig.get_requires_for_build_wheel(config_settings) + packages diff --git a/pyproject.toml b/pyproject.toml index fd738178..7532cee2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,80 @@ [build-system] requires = [ - "setuptools>=42", - "scikit-build~=0.18.0", + "scikit-build-core @ git@github.com:scikit-build/scikit-build-core.git", "Cython >=3.0.11, <3.1.0" ] -build-backend = "backend" -backend-path = ["_custom_build"] +build-backend = "scikit_build_core.build" + +[project] +name = "RapidFuzz" +dynamic = ["version"] +dependencies = [ + "rapidfuzz >= 3.8.0, < 4.0.0" +] +requires-python = ">= 3.8" +authors = [ + {name = "Max Bachmann", email = "pypi@maxbachmann.de"}, +] +description = "Python extension for computing string edit distances and similarities." +readme = "README.md" +classifiers=[ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", +] +Homepage = "https://github.com/rapidfuzz/RapidFuzz" +Documentation = "https://rapidfuzz.github.io/RapidFuzz/" +Repository = "https://github.com/rapidfuzz/RapidFuzz.git" +Issues = "https://github.com/rapidfuzz/RapidFuzz/issues" +Changelog = "https://github.com/rapidfuzz/RapidFuzz/blob/main/CHANGELOG.rst" + +[project.entry-points.pyinstaller40] +hook-dirs = "rapidfuzz.__pyinstaller:get_hook_dirs" +tests = "rapidfuzz.__pyinstaller:get_PyInstaller_tests" + +[tool.scikit-build] +sdist.include = [ + "src/rapidfuzz/*.cxx", + "src/rapidfuzz/distance/*.cxx", +] +sdist.exclude = [ + ".github" +] +wheel.exclude = [ + "**.pyx", + "**.cxx", + "**.cpp", + "**.hpp", + "CMakeLists.txt", + "generate.sh" +] +wheel.cmake = false + +[[tool.scikit-build.overrides]] +if.any.system-cmake = ">=3.15" +if.any.cmake-wheel = true +wheel.cmake = true + +[tool.scikit-build.overrides] +if.failed = true +wheel.cmake = false + +[[tool.scikit-build.overrides]] +if.any.env.CIBUILDWHEEL = "1" +if.any.env.CONDA_BUILD = "1" +if.any.env.PIWHEELS_BUILD = "1" +if.any.env.RAPIDFUZZ_BUILD_EXTENSION = "1" +wheel.cmake = true +error-message = "failed to build C++ Extension in a packaged build" + +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "src/rapidfuzz/__init__.py" + [tool.black] line-length = 120 From 2d3c291706655565f0143749fd431d7d66f66890 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 1 Aug 2024 23:24:53 +0200 Subject: [PATCH 02/19] fix build --- pyproject.toml | 7 +++++-- src/rapidfuzz/CMakeLists.txt | 28 +++++++++++++++------------ src/rapidfuzz/distance/CMakeLists.txt | 25 +++++++++++++----------- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7532cee2..8462df60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "scikit-build-core @ git@github.com:scikit-build/scikit-build-core.git", + "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core", "Cython >=3.0.11, <3.1.0" ] build-backend = "scikit_build_core.build" @@ -47,11 +47,14 @@ sdist.exclude = [ wheel.exclude = [ "**.pyx", "**.cxx", + "**.pxd", "**.cpp", "**.hpp", + "**.h", "CMakeLists.txt", "generate.sh" ] +wheel.packages = ["src/rapidfuzz"] wheel.cmake = false [[tool.scikit-build.overrides]] @@ -59,7 +62,7 @@ if.any.system-cmake = ">=3.15" if.any.cmake-wheel = true wheel.cmake = true -[tool.scikit-build.overrides] +[[tool.scikit-build.overrides]] if.failed = true wheel.cmake = false diff --git a/src/rapidfuzz/CMakeLists.txt b/src/rapidfuzz/CMakeLists.txt index 2e7a3549..a4bfbba3 100644 --- a/src/rapidfuzz/CMakeLists.txt +++ b/src/rapidfuzz/CMakeLists.txt @@ -4,13 +4,17 @@ function(create_cython_target _name) ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx PARENT_SCOPE) else() - find_package(Cython REQUIRED) - # should use target_include_directories once this is supported by - # scikit-build - include_directories(${RF_BASE_DIR}/rapidfuzz) - add_cython_target(${_name} CXX) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx" + MAIN_DEPENDENCY "${CMAKE_CURRENT_LIST_DIR}/${_name}.pyx" + VERBATIM + COMMAND + Python::Interpreter -m cython "${CMAKE_CURRENT_LIST_DIR}/${_name}.pyx" + --cplus -I "${CMAKE_CURRENT_LIST_DIR}" + --output-file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx") + set(${_name} - ${_name} + ${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx PARENT_SCOPE) endif() endfunction(create_cython_target) @@ -39,7 +43,7 @@ if(RAPIDFUZZ_ARCH_X64 OR RAPIDFUZZ_ARCH_X86) target_include_directories(_feature_detector_cpp PRIVATE ${RF_BASE_DIR}/rapidfuzz) target_link_libraries(_feature_detector_cpp PRIVATE rapidfuzz::rapidfuzz) - install(TARGETS _feature_detector_cpp LIBRARY DESTINATION src/rapidfuzz) + install(TARGETS _feature_detector_cpp DESTINATION rapidfuzz) endif() create_cython_target(utils_cpp) @@ -47,14 +51,14 @@ rf_add_library(utils_cpp ${utils_cpp} ${CMAKE_CURRENT_LIST_DIR}/utils.cpp) target_compile_features(utils_cpp PUBLIC cxx_std_17) target_include_directories(utils_cpp PRIVATE ${RF_BASE_DIR}/rapidfuzz) target_link_libraries(utils_cpp PRIVATE rapidfuzz::rapidfuzz) -install(TARGETS utils_cpp LIBRARY DESTINATION src/rapidfuzz) +install(TARGETS utils_cpp DESTINATION rapidfuzz) create_cython_target(fuzz_cpp) rf_add_library(fuzz_cpp ${fuzz_cpp}) target_compile_features(fuzz_cpp PUBLIC cxx_std_17) target_include_directories(fuzz_cpp PRIVATE ${RF_BASE_DIR}/rapidfuzz) target_link_libraries(fuzz_cpp PRIVATE rapidfuzz::rapidfuzz) -install(TARGETS fuzz_cpp LIBRARY DESTINATION src/rapidfuzz) +install(TARGETS fuzz_cpp DESTINATION rapidfuzz) if(RAPIDFUZZ_ARCH_X64 OR RAPIDFUZZ_ARCH_X86) # on macOs this generates illegal instructions @@ -72,7 +76,7 @@ if(RAPIDFUZZ_ARCH_X64 OR RAPIDFUZZ_ARCH_X86) target_include_directories(fuzz_cpp_avx2 PRIVATE ${RF_BASE_DIR}/rapidfuzz) target_link_libraries(fuzz_cpp_avx2 PRIVATE rapidfuzz::rapidfuzz) - install(TARGETS fuzz_cpp_avx2 LIBRARY DESTINATION src/rapidfuzz) + install(TARGETS fuzz_cpp_avx2 DESTINATION rapidfuzz) endif() endif() @@ -89,7 +93,7 @@ if(RAPIDFUZZ_ARCH_X86) target_include_directories(fuzz_cpp_sse2 PRIVATE ${RF_BASE_DIR}/rapidfuzz) target_link_libraries(fuzz_cpp_sse2 PRIVATE rapidfuzz::rapidfuzz) - install(TARGETS fuzz_cpp_sse2 LIBRARY DESTINATION src/rapidfuzz) + install(TARGETS fuzz_cpp_sse2 DESTINATION rapidfuzz) endif() create_cython_target(process_cpp_impl) @@ -185,4 +189,4 @@ if(NOT Windows) endif() endif() -install(TARGETS process_cpp_impl LIBRARY DESTINATION src/rapidfuzz) +install(TARGETS process_cpp_impl DESTINATION rapidfuzz) diff --git a/src/rapidfuzz/distance/CMakeLists.txt b/src/rapidfuzz/distance/CMakeLists.txt index e9350911..59f7cbc7 100644 --- a/src/rapidfuzz/distance/CMakeLists.txt +++ b/src/rapidfuzz/distance/CMakeLists.txt @@ -4,14 +4,17 @@ function(create_cython_target _name) ${CMAKE_CURRENT_LIST_DIR}/${_name}.cxx PARENT_SCOPE) else() - find_package(Cython REQUIRED) - # should use target_include_directories once this is supported by - # scikit-build - include_directories(${RF_BASE_DIR}/rapidfuzz - ${RF_BASE_DIR}/rapidfuzz/distance) - add_cython_target(${_name} CXX) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx" + MAIN_DEPENDENCY "${CMAKE_CURRENT_LIST_DIR}/${_name}.pyx" + VERBATIM + COMMAND + Python::Interpreter -m cython "${CMAKE_CURRENT_LIST_DIR}/${_name}.pyx" + --cplus -I "${CMAKE_CURRENT_LIST_DIR}/.." + --output-file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx") + set(${_name} - ${_name} + ${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx PARENT_SCOPE) endif() endfunction(create_cython_target) @@ -39,7 +42,7 @@ target_include_directories( _initialize_cpp PRIVATE ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance) target_link_libraries(_initialize_cpp PRIVATE rapidfuzz::rapidfuzz) -install(TARGETS _initialize_cpp LIBRARY DESTINATION src/rapidfuzz/distance) +install(TARGETS _initialize_cpp DESTINATION rapidfuzz/distance) create_cython_target(metrics_cpp) rf_add_library(metrics_cpp ${metrics_cpp}) @@ -48,7 +51,7 @@ target_include_directories( metrics_cpp PRIVATE ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance) target_link_libraries(metrics_cpp PRIVATE rapidfuzz::rapidfuzz) -install(TARGETS metrics_cpp LIBRARY DESTINATION src/rapidfuzz/distance) +install(TARGETS metrics_cpp DESTINATION rapidfuzz/distance) if(RAPIDFUZZ_ARCH_X64 OR RAPIDFUZZ_ARCH_X86) # on macOs this generates illegal instructions @@ -69,7 +72,7 @@ if(RAPIDFUZZ_ARCH_X64 OR RAPIDFUZZ_ARCH_X86) metrics_cpp_avx2 PRIVATE ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance) target_link_libraries(metrics_cpp_avx2 PRIVATE rapidfuzz::rapidfuzz) - install(TARGETS metrics_cpp_avx2 LIBRARY DESTINATION src/rapidfuzz/distance) + install(TARGETS metrics_cpp_avx2 DESTINATION rapidfuzz/distance) endif() endif() @@ -89,5 +92,5 @@ if(RAPIDFUZZ_ARCH_X86) metrics_cpp_sse2 PRIVATE ${RF_BASE_DIR}/rapidfuzz ${RF_BASE_DIR}/rapidfuzz/distance) target_link_libraries(metrics_cpp_sse2 PRIVATE rapidfuzz::rapidfuzz) - install(TARGETS metrics_cpp_sse2 LIBRARY DESTINATION src/rapidfuzz/distance) + install(TARGETS metrics_cpp_sse2 DESTINATION rapidfuzz/distance) endif() From 70edc2180d1c6525b78ec9f6580a6fe730111e32 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 1 Aug 2024 23:28:00 +0200 Subject: [PATCH 03/19] update patch --- tools/sdist.patch | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/sdist.patch b/tools/sdist.patch index 2c7610c8..34ee127f 100644 --- a/tools/sdist.patch +++ b/tools/sdist.patch @@ -1,14 +1,13 @@ diff --git a/pyproject.toml b/pyproject.toml -index 77671b1..7692f90 100644 +index 517f32d..1e855ed 100644 --- a/pyproject.toml +++ b/pyproject.toml -@@ -1,8 +1,7 @@ +@@ -1,7 +1,6 @@ [build-system] requires = [ - "setuptools>=42", -- "scikit-build~=0.18.0", +- "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core", - "Cython >=3.0.11, <3.1.0" -+ "scikit-build~=0.18.0" ++ "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core" ] - build-backend = "backend" - backend-path = ["_custom_build"] + build-backend = "scikit_build_core.build" + From aa7b4d3561f1e1acaa6d2a6aea8f5a0ec2f3a35b Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 1 Aug 2024 23:34:27 +0200 Subject: [PATCH 04/19] fix project properties --- pyproject.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8462df60..ecbda58d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ requires-python = ">= 3.8" authors = [ {name = "Max Bachmann", email = "pypi@maxbachmann.de"}, ] -description = "Python extension for computing string edit distances and similarities." +description = "rapid fuzzy string matching" readme = "README.md" classifiers=[ "Programming Language :: Python :: 3", @@ -32,6 +32,11 @@ Repository = "https://github.com/rapidfuzz/RapidFuzz.git" Issues = "https://github.com/rapidfuzz/RapidFuzz/issues" Changelog = "https://github.com/rapidfuzz/RapidFuzz/blob/main/CHANGELOG.rst" +[project.optional-dependencies] +all = [ + "numpy" +] + [project.entry-points.pyinstaller40] hook-dirs = "rapidfuzz.__pyinstaller:get_hook_dirs" tests = "rapidfuzz.__pyinstaller:get_PyInstaller_tests" From fb9ff36ed5ade01b48bea6abe16024ea58e8b060 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Fri, 2 Aug 2024 22:07:26 +0200 Subject: [PATCH 05/19] Update pyproject.toml --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ecbda58d..67055e36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,9 +8,6 @@ build-backend = "scikit_build_core.build" [project] name = "RapidFuzz" dynamic = ["version"] -dependencies = [ - "rapidfuzz >= 3.8.0, < 4.0.0" -] requires-python = ">= 3.8" authors = [ {name = "Max Bachmann", email = "pypi@maxbachmann.de"}, From 69aa80535dfa7da1944ac15c8b258de116cc2da2 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Tue, 6 Aug 2024 22:51:16 +0200 Subject: [PATCH 06/19] Update pyproject.toml Co-authored-by: Henry Schreiner --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 67055e36..1c0a47dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,10 +69,10 @@ if.failed = true wheel.cmake = false [[tool.scikit-build.overrides]] -if.any.env.CIBUILDWHEEL = "1" -if.any.env.CONDA_BUILD = "1" -if.any.env.PIWHEELS_BUILD = "1" -if.any.env.RAPIDFUZZ_BUILD_EXTENSION = "1" +if.any.env.CIBUILDWHEEL = true +if.any.env.CONDA_BUILD = true +if.any.env.PIWHEELS_BUILD = true +if.any.env.RAPIDFUZZ_BUILD_EXTENSION = true wheel.cmake = true error-message = "failed to build C++ Extension in a packaged build" From 1cf364348087de415fcb111f93560e0738dd12b9 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 7 Aug 2024 10:45:15 +0200 Subject: [PATCH 07/19] Update pyproject.toml Co-authored-by: Henry Schreiner --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 1c0a47dc..a098f02f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ hook-dirs = "rapidfuzz.__pyinstaller:get_hook_dirs" tests = "rapidfuzz.__pyinstaller:get_PyInstaller_tests" [tool.scikit-build] +minimum-version = "build-system.requires" sdist.include = [ "src/rapidfuzz/*.cxx", "src/rapidfuzz/distance/*.cxx", From 615a9ac0155ab446eb83857ad1771f753afa6bb3 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 7 Aug 2024 10:45:40 +0200 Subject: [PATCH 08/19] Update pyproject.toml Co-authored-by: Henry Schreiner --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a098f02f..92531918 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core", + "scikit-build-core>=0.10.0", "Cython >=3.0.11, <3.1.0" ] build-backend = "scikit_build_core.build" From 0bc454b3e3ff1da7c50751c37ebac0cf8b626ef2 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 7 Aug 2024 10:45:55 +0200 Subject: [PATCH 09/19] Update tools/sdist.patch Co-authored-by: Henry Schreiner --- tools/sdist.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sdist.patch b/tools/sdist.patch index 34ee127f..bd48595e 100644 --- a/tools/sdist.patch +++ b/tools/sdist.patch @@ -7,7 +7,7 @@ index 517f32d..1e855ed 100644 requires = [ - "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core", - "Cython >=3.0.11, <3.1.0" -+ "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core" ++ "scikit-build-core>=0.10.0" ] build-backend = "scikit_build_core.build" From 1d1abe89fed0e0aead71d664b50a7a0e2fd09f17 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Wed, 7 Aug 2024 11:09:27 +0200 Subject: [PATCH 10/19] fix patch --- tools/sdist.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sdist.patch b/tools/sdist.patch index bd48595e..29d1f3e3 100644 --- a/tools/sdist.patch +++ b/tools/sdist.patch @@ -5,7 +5,7 @@ index 517f32d..1e855ed 100644 @@ -1,7 +1,6 @@ [build-system] requires = [ -- "scikit-build-core @ git+https://github.com/scikit-build/scikit-build-core", +- "scikit-build-core>=0.10.0", - "Cython >=3.0.11, <3.1.0" + "scikit-build-core>=0.10.0" ] From 35b379aca53957c61825e4ab788fb06466f763a6 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 19 Sep 2024 23:38:49 +0200 Subject: [PATCH 11/19] further cleanup --- pyproject.toml | 6 ++-- setup.py | 87 ----------------------------------------------- tools/sdist.patch | 4 +-- 3 files changed, 5 insertions(+), 92 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 92531918..c14009fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "scikit-build-core>=0.10.0", + "scikit-build-core>=0.10.1", "Cython >=3.0.11, <3.1.0" ] build-backend = "scikit_build_core.build" @@ -8,7 +8,7 @@ build-backend = "scikit_build_core.build" [project] name = "RapidFuzz" dynamic = ["version"] -requires-python = ">= 3.8" +requires-python = ">= 3.9" authors = [ {name = "Max Bachmann", email = "pypi@maxbachmann.de"}, ] @@ -16,11 +16,11 @@ description = "rapid fuzzy string matching" readme = "README.md" classifiers=[ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: MIT License", ] Homepage = "https://github.com/rapidfuzz/RapidFuzz" diff --git a/setup.py b/setup.py deleted file mode 100644 index 1c185a2f..00000000 --- a/setup.py +++ /dev/null @@ -1,87 +0,0 @@ -from __future__ import annotations - -import os - - -def show_message(*lines): - print("=" * 74) - for line in lines: - print(line) - print("=" * 74) - - -with open("README.md", encoding="utf8") as f: - readme = f.read() - -setup_args = { - "name": "rapidfuzz", - "version": "3.9.7", - "extras_require": {"full": ["numpy"]}, - "url": "https://github.com/rapidfuzz/RapidFuzz", - "author": "Max Bachmann", - "author_email": "pypi@maxbachmann.de", - "description": "rapid fuzzy string matching", - "long_description": readme, - "long_description_content_type": "text/markdown", - "license": "MIT", - "classifiers": [ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "License :: OSI Approved :: MIT License", - ], - "packages": ["rapidfuzz", "rapidfuzz.distance", "rapidfuzz.__pyinstaller"], - "entry_points": { - "pyinstaller40": [ - "hook-dirs = rapidfuzz.__pyinstaller:get_hook_dirs", - "tests = rapidfuzz.__pyinstaller:get_PyInstaller_tests", - ], - }, - "package_dir": { - "": "src", - }, - "package_data": { - "rapidfuzz": ["*.pyi", "py.typed", "__init__.pxd", "rapidfuzz.h"], - "rapidfuzz.distance": ["*.pyi"], - }, - "python_requires": ">=3.9", -} - - -def run_setup(with_binary): - if with_binary: - from skbuild import setup - - setup(**setup_args) - else: - from setuptools import setup - - setup(**setup_args) - - -# when packaging only build wheels which include the C extension -packaging = "1" in { - os.environ.get("CIBUILDWHEEL", "0"), - os.environ.get("CONDA_BUILD", "0"), - os.environ.get("PIWHEELS_BUILD", "0"), - os.environ.get("RAPIDFUZZ_BUILD_EXTENSION", "0"), -} -if packaging: - run_setup(True) -else: - try: - run_setup(True) - except BaseException: - show_message( - "WARNING: The C extension could not be compiled, speedups are not enabled.", - "Failure information, if any, is above.", - "Retrying the build without the C extension now.", - ) - run_setup(False) - show_message( - "WARNING: The C extension could not be compiled, speedups are not enabled.", - "Plain-Python build succeeded.", - ) diff --git a/tools/sdist.patch b/tools/sdist.patch index 29d1f3e3..a27c3944 100644 --- a/tools/sdist.patch +++ b/tools/sdist.patch @@ -5,9 +5,9 @@ index 517f32d..1e855ed 100644 @@ -1,7 +1,6 @@ [build-system] requires = [ -- "scikit-build-core>=0.10.0", +- "scikit-build-core>=0.10.1", - "Cython >=3.0.11, <3.1.0" -+ "scikit-build-core>=0.10.0" ++ "scikit-build-core>=0.10.1" ] build-backend = "scikit_build_core.build" From 03e5167ee155f86ca7717ef7fc5c7a6ec03e8f73 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Fri, 20 Sep 2024 01:19:20 +0200 Subject: [PATCH 12/19] fix failure message --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c14009fb..31cc37b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ if.any.env.CONDA_BUILD = true if.any.env.PIWHEELS_BUILD = true if.any.env.RAPIDFUZZ_BUILD_EXTENSION = true wheel.cmake = true -error-message = "failed to build C++ Extension in a packaged build" +messages.after-failure = "failed to build C++ Extension in a packaged build" [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" From 344c3cd596a9889427886d499e6510a76f82bf07 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Fri, 20 Sep 2024 01:32:25 +0200 Subject: [PATCH 13/19] add warning message --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 31cc37b1..48e5decd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,7 @@ wheel.cmake = true [[tool.scikit-build.overrides]] if.failed = true wheel.cmake = false +messages.after-success = "failed to build C++ Extension, falling back to pure Python Extension" [[tool.scikit-build.overrides]] if.any.env.CIBUILDWHEEL = true From 0a265a8570be7e55798d8f24a8bc5d9898146257 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sat, 21 Sep 2024 16:41:42 +0200 Subject: [PATCH 14/19] update scikit-build-core --- pyproject.toml | 6 +++++- tools/sdist.patch | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 48e5decd..6b470da9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "scikit-build-core>=0.10.1", + "scikit-build-core>=0.10.7", "Cython >=3.0.11, <3.1.0" ] build-backend = "scikit_build_core.build" @@ -67,6 +67,10 @@ wheel.cmake = true [[tool.scikit-build.overrides]] if.failed = true +if.env.CIBUILDWHEEL = false +if.env.CONDA_BUILD = false +if.env.PIWHEELS_BUILD = false +if.env.RAPIDFUZZ_BUILD_EXTENSION = false wheel.cmake = false messages.after-success = "failed to build C++ Extension, falling back to pure Python Extension" diff --git a/tools/sdist.patch b/tools/sdist.patch index a27c3944..cc463ec2 100644 --- a/tools/sdist.patch +++ b/tools/sdist.patch @@ -5,9 +5,9 @@ index 517f32d..1e855ed 100644 @@ -1,7 +1,6 @@ [build-system] requires = [ -- "scikit-build-core>=0.10.1", +- "scikit-build-core>=0.10.7", - "Cython >=3.0.11, <3.1.0" -+ "scikit-build-core>=0.10.1" ++ "scikit-build-core>=0.10.7" ] build-backend = "scikit_build_core.build" From 6410843aeab432ca42f3e2d5fc364ea5b4e4d44d Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sat, 21 Sep 2024 16:43:51 +0200 Subject: [PATCH 15/19] add colors --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6b470da9..3e7cadae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ if.env.CONDA_BUILD = false if.env.PIWHEELS_BUILD = false if.env.RAPIDFUZZ_BUILD_EXTENSION = false wheel.cmake = false -messages.after-success = "failed to build C++ Extension, falling back to pure Python Extension" +messages.after-success = "{yellow}failed to build C++ Extension, falling back to pure Python Extension" [[tool.scikit-build.overrides]] if.any.env.CIBUILDWHEEL = true @@ -80,7 +80,7 @@ if.any.env.CONDA_BUILD = true if.any.env.PIWHEELS_BUILD = true if.any.env.RAPIDFUZZ_BUILD_EXTENSION = true wheel.cmake = true -messages.after-failure = "failed to build C++ Extension in a packaged build" +messages.after-failure = "{red}failed to build C++ Extension in a packaged build" [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" From 4bd16f792bdfc0ef337a2ce0e8a7517203c5dc3d Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sat, 21 Sep 2024 17:33:09 +0200 Subject: [PATCH 16/19] update messaging --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3e7cadae..f999eb78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,11 +59,13 @@ wheel.exclude = [ ] wheel.packages = ["src/rapidfuzz"] wheel.cmake = false +messages.after-success = "{yellow}Failed to build C++ Extension, falling back to pure Python Extension" [[tool.scikit-build.overrides]] if.any.system-cmake = ">=3.15" if.any.cmake-wheel = true wheel.cmake = true +messages.after-success = "{green}C++ Extension built successfully" [[tool.scikit-build.overrides]] if.failed = true @@ -72,7 +74,7 @@ if.env.CONDA_BUILD = false if.env.PIWHEELS_BUILD = false if.env.RAPIDFUZZ_BUILD_EXTENSION = false wheel.cmake = false -messages.after-success = "{yellow}failed to build C++ Extension, falling back to pure Python Extension" +messages.after-success = "{yellow}Failed to build C++ Extension, falling back to pure Python Extension" [[tool.scikit-build.overrides]] if.any.env.CIBUILDWHEEL = true @@ -80,7 +82,8 @@ if.any.env.CONDA_BUILD = true if.any.env.PIWHEELS_BUILD = true if.any.env.RAPIDFUZZ_BUILD_EXTENSION = true wheel.cmake = true -messages.after-failure = "{red}failed to build C++ Extension in a packaged build" +messages.after-success = "{green}C++ Extension built successfully" +messages.after-failure = "{red}Failed to build C++ Extension in a packaged build" [tool.scikit-build.metadata.version] provider = "scikit_build_core.metadata.regex" From 32fcaad6f5a97ba98caacb97cd4dd9c922330daf Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sat, 21 Sep 2024 17:35:54 +0200 Subject: [PATCH 17/19] further improve message --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f999eb78..efff1059 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ wheel.exclude = [ ] wheel.packages = ["src/rapidfuzz"] wheel.cmake = false -messages.after-success = "{yellow}Failed to build C++ Extension, falling back to pure Python Extension" +messages.after-success = "{yellow}Cmake unavailable, falling back to pure Python Extension" [[tool.scikit-build.overrides]] if.any.system-cmake = ">=3.15" From 229492253d6faa4c8128c1a4e63a169dc2535d80 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sat, 21 Sep 2024 18:00:16 +0200 Subject: [PATCH 18/19] allow pre releases --- .github/workflows/branchbuild.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/branchbuild.yml b/.github/workflows/branchbuild.yml index 844c1ef7..ca581fc7 100644 --- a/.github/workflows/branchbuild.yml +++ b/.github/workflows/branchbuild.yml @@ -148,6 +148,7 @@ jobs: submodules: 'true' - uses: "actions/setup-python@v5" with: + allow-prereleases: true python-version: "${{ matrix.python-version }}" - name: build From 6c0b80a0c58b0abbf82941dcbe25e09f6487f86c Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Sat, 21 Sep 2024 18:28:37 +0200 Subject: [PATCH 19/19] update changelog --- CHANGELOG.rst | 15 ++++++++------- src/rapidfuzz/__init__.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7de15c31..7291b9a6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,19 @@ Changelog --------- +[3.10.0] - 2024-09-21 +^^^^^^^^^^^^^^^^^^^^^ +Fixed +~~~~~ +- drop support for Python 3.8 +- switch build system to `scikit-build-core` + [3.9.7] - 2024-09-02 ^^^^^^^^^^^^^^^^^^^^ Fixed -~~~~~~~ +~~~~~ * fix crash in ``cdist`` due to Visual Studio upgrade - [3.9.6] - 2024-08-06 ^^^^^^^^^^^^^^^^^^^^ Changed @@ -41,14 +47,12 @@ Fixed ~~~~~ * fix supported versions of taskflow in cmake to be in the range v3.3 - v3.7 - [3.9.1] - 2024-05-19 ^^^^^^^^^^^^^^^^^^^^ Fixed ~~~~~ * disable AVX2 on MacOS since it did lead to illegal instructions being generated - [3.9.0] - 2024-05-02 ^^^^^^^^^^^^^^^^^^^^ Changed @@ -59,14 +63,12 @@ Fixed ~~~~~ * fix cmake version parsing - [3.8.1] - 2024-04-07 ^^^^^^^^^^^^^^^^^^^^ Fixed ~~~~~ * use the correct version of ``rapidfuzz-cpp`` when building against a system installed version - [3.8.0] - 2024-04-06 ^^^^^^^^^^^^^^^^^^^^ Added @@ -78,7 +80,6 @@ Fixed - fix some minor errors in the type hints - fix potentially incorrect results of JaroWinkler when using high prefix weights - [3.7.0] - 2024-03-21 ^^^^^^^^^^^^^^^^^^^^ Changed diff --git a/src/rapidfuzz/__init__.py b/src/rapidfuzz/__init__.py index 66e10fa8..63e5062a 100644 --- a/src/rapidfuzz/__init__.py +++ b/src/rapidfuzz/__init__.py @@ -6,7 +6,7 @@ __author__: str = "Max Bachmann" __license__: str = "MIT" -__version__: str = "3.9.7" +__version__: str = "3.10.0" from rapidfuzz import distance, fuzz, process, utils