From 13561ccca679896246b57c1181b214b702b8b189 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 1 Aug 2024 22:48:14 +0200 Subject: [PATCH 01/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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/13] 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