1{ lib 2, stdenv 3, fetchPypi 4, fetchpatch 5, buildPythonPackage 6, isPy3k 7, rustPlatform 8, setuptools-rust 9, libiconv 10}: 11 12buildPythonPackage rec { 13 pname = "spacy-alignments"; 14 version = "0.8.3"; 15 16 disabled = !isPy3k; 17 18 src = fetchPypi { 19 inherit pname version; 20 hash = "sha256-zrqBjaIjtF6bJMbmw7Zo+BeApN6sxxfLkrzsDjdvC78="; 21 }; 22 23 cargoDeps = rustPlatform.fetchCargoTarball { 24 inherit patches src; 25 name = "${pname}-${version}"; 26 hash = "sha256-YRyG2yflEXKklNqXiDD9oK3J1lq4o704+Eeu2hyY3xI="; 27 }; 28 29 patches = [ 30 # Add Cargo.lock, from upstream PR: 31 # https://github.com/explosion/spacy-alignments/pull/3 32 (fetchpatch { 33 url = "https://github.com/explosion/spacy-alignments/commit/7b0ba13ff0d245bfbbe344a36fb7bbd311dd4906.diff"; 34 sha256 = "sha256-jx97SSC+3z+ByInNs8Uq58H50eCo4fDCwEi6VKxRs2k="; 35 excludes = [ ".gitignore" ]; 36 }) 37 ]; 38 39 nativeBuildInputs = [ 40 setuptools-rust 41 ] ++ (with rustPlatform; [ 42 cargoSetupHook 43 rust.cargo 44 rust.rustc 45 ]); 46 47 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; 48 49 # Fails because spacy_alignments module cannot be loaded correctly. 50 doCheck = false; 51 52 pythonImportsCheck = [ "spacy_alignments" ]; 53 54 meta = with lib; { 55 description = "Align tokenizations for spaCy and transformers"; 56 homepage = "https://github.com/explosion/spacy-alignments"; 57 license = licenses.mit; 58 maintainers = with maintainers; [ ]; 59 }; 60}