Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pkgs/development/libraries/rapidfuzz-cpp/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
}:

stdenv.mkDerivation rec {
pname = "rapidfuzz-cpp";
version = "1.0.0";

src = fetchFromGitHub {
owner = "maxbachmann";
repo = pname;
rev = "v${version}";
sha256 = "1g30ckm78ixsd06s067saaqbw97mkxyhfn75dr0ql7i3j9ghz7mw";
};

nativeBuildInputs = [ cmake ];

cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ];

meta = with lib; {
description = "Rapid fuzzy string matching in C++ using the Levenshtein Distance";
homepage = "https://github.com/maxbachmann/rapidfuzz-cpp";
license = licenses.mit;
maintainers = with maintainers; [ fab ];
platforms = platforms.all;
};
}
42 changes: 36 additions & 6 deletions pkgs/development/python-modules/levenshtein/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,52 @@
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, pytestCheckHook
, python
, cmake
, ninja
, cython
, scikit-build
, setuptools
, rapidfuzz-cpp
, rapidfuzz
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "levenshtein";
version = "0.18.1";
format = "setuptools";
format = "pyproject";

disabled = pythonOlder "3.6";

src = fetchFromGitHub {
owner = "maxbachmann";
repo = "Levenshtein";
repo = pname;
rev = "v${version}";
sha256 = "sha256-3p9LM4tv45bqeTsuyngivqfd5uml7uqGB2ICKqPa0qY=";
fetchSubmodules = true;
sha256 = "sha256-WREYdD5MFOpCzH4BSceRpzQZdpi3Xxxn0DpMvDsNlGo=";
};

postPatch = ''
substituteInPlace setup.cfg \
--replace "rapidfuzz >= 1.8.2, < 1.9" "rapidfuzz"
substituteInPlace setup.py \
--replace ", < 3.0.0" ""

substituteInPlace pyproject.toml \
--replace "Cython==3.0.0a10" "Cython>=0.29.0"
'';

nativeBuildInputs = [
cmake
ninja
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be patched out or just left out if you use format = "setuptools"

cython
scikit-build
setuptools
];

buildInputs = [
rapidfuzz-cpp
];

propagatedBuildInputs = [
rapidfuzz
];
Expand All @@ -33,6 +56,12 @@ buildPythonPackage rec {
pytestCheckHook
];

dontUseCmakeConfigure = true;

cmakeFlags = [
"-DCMAKE_MODULE_PATH=${python.pkgs.scikit-build}/${python.sitePackages}/skbuild/resources/cmake"
];
Comment on lines +61 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cmakeFlags = [
"-DCMAKE_MODULE_PATH=${python.pkgs.scikit-build}/${python.sitePackages}/skbuild/resources/cmake"
];


pythonImportsCheck = [
"Levenshtein"
];
Expand All @@ -42,5 +71,6 @@ buildPythonPackage rec {
homepage = "https://github.com/maxbachmann/Levenshtein";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ fab ];
platforms = platforms.all;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
platforms = platforms.all;

that's automatic for Python packages

};
}
26 changes: 26 additions & 0 deletions pkgs/development/python-modules/rapidfuzz-capi/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
}:

buildPythonPackage rec {
pname = "rapidfuzz-capi";
version = "1.0.2";
format = "pyproject";

src = fetchFromGitHub {
owner = "maxbachmann";
repo = "rapidfuzz_capi";
rev = "v.${version}";
sha256 = "127mwjbyp2nfj846bxb3aajmhsgzfx4wfvizpnwb30yv2fcrpy7l";
};

pythonImportsCheck = [ "rapidfuzz_capi" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs pytestCheckHook in checkInputs or a checkPhase.


meta = with lib; {
description = "C-API of RapidFuzz, which can be used to extend RapidFuzz from separate packages";
homepage = "https://github.com/maxbachmann/rapidfuzz_capi";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dotlambda ? 28b65c3#diff-7051ba4a27a1aa6bb264875507a22237c6aaf3566a13335c6c96f76593be5314

i'm probably going to remove this file and wait for your pr to get merged

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant to put this on the respective line in rapidfuzz-cpp

};
}
40 changes: 33 additions & 7 deletions pkgs/development/python-modules/rapidfuzz/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,60 @@
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, pytestCheckHook
, cmake
, cython
, scikit-build
, python
, numpy
, rapidfuzz-capi
, hypothesis
, pandas
, numpy
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "rapidfuzz";
version = "1.9.1";
version = "2.0.8";
format = "pyproject";

disabled = pythonOlder "3.5";
disabled = pythonOlder "3.6";

src = fetchFromGitHub {
owner = "maxbachmann";
repo = "RapidFuzz";
repo = pname;
rev = "v${version}";
fetchSubmodules = true;
sha256 = "sha256-aZqsQHrxmPqZARkqR1hWaj7XndOlCJjmWk1Cosx4skA=";
sha256 = "sha256-LA4UpP3jFcVZTYKuq8aBvfGgEhyOLeCUsUXEgSnwb94=";
};

nativeBuildInputs = [
cmake
cython
scikit-build
];

postPatch = ''
substituteInPlace pyproject.toml \
--replace "==" ">=" \
--replace "Cython==3.0.0a10" "Cython>=0.29.0" \
--replace "scikit-build>=0.13.0" "scikit-build>=0.12.0"
'';

dontUseCmakeConfigure = true;

cmakeFlags = [
"-DCMAKE_MODULE_PATH=${scikit-build}/${python.sitePackages}/skbuild/resources/cmake"
];

propagatedBuildInputs = [
numpy
rapidfuzz-capi
];

checkInputs = [
pytestCheckHook
hypothesis
pandas
pytestCheckHook
];

disabledTests = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19886,6 +19886,8 @@ with pkgs;

rapidcheck = callPackage ../development/libraries/rapidcheck {};

rapidfuzz-cpp = callPackage ../development/libraries/rapidfuzz-cpp {};

rapidjson = callPackage ../development/libraries/rapidjson {};

rapidxml = callPackage ../development/libraries/rapidxml {};
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8669,6 +8669,8 @@ in {

rapidfuzz = callPackage ../development/python-modules/rapidfuzz { };

rapidfuzz-capi = callPackage ../development/python-modules/rapidfuzz-capi { };

rarfile = callPackage ../development/python-modules/rarfile {
inherit (pkgs) libarchive;
};
Expand Down