depot/third_party/nixpkgs/pkgs/development/python-modules/levenshtein/default.nix
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

63 lines
1.3 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, cmake
, cython_3
, pytestCheckHook
, rapidfuzz
, rapidfuzz-cpp
, scikit-build
}:
buildPythonPackage rec {
pname = "levenshtein";
version = "0.22.0";
format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "maxbachmann";
repo = "Levenshtein";
rev = "refs/tags/v${version}";
hash = "sha256-rqbZ2+UfWhh5qEd1GL6W9edHPCSNnK3s/Y2aT3R5wCA=";
};
nativeBuildInputs = [
cmake
cython_3
scikit-build
];
dontUseCmakeConfigure = true;
buildInputs = [
rapidfuzz-cpp
];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isClang && stdenv.isDarwin) [
"-fno-lto" # work around https://github.com/NixOS/nixpkgs/issues/19098
]);
propagatedBuildInputs = [
rapidfuzz
];
nativeCheckInputs = [
pytestCheckHook
];
pythonImportsCheck = [
"Levenshtein"
];
meta = with lib; {
description = "Functions for fast computation of Levenshtein distance and string similarity";
homepage = "https://github.com/maxbachmann/Levenshtein";
changelog = "https://github.com/maxbachmann/Levenshtein/blob/${src.rev}/HISTORY.md";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ fab ];
};
}