depot/third_party/nixpkgs/pkgs/development/python-modules/sudachipy/default.nix
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

67 lines
1.3 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
cargo,
libiconv,
rustPlatform,
rustc,
sudachi-rs,
setuptools-rust,
pytestCheckHook,
sudachidict-core,
tokenizers,
sudachipy,
}:
buildPythonPackage rec {
pname = "sudachipy";
inherit (sudachi-rs) src version;
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
hash = "sha256-ARwvThfATDdzBTjPFr9yjbE/0eYvp/TCZOEGbUupJmU=";
};
nativeBuildInputs = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools-rust
];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
preBuild = ''
cd python
'';
# avoid infinite recursion due to sudachidict
doCheck = false;
nativeCheckInputs = [
pytestCheckHook
sudachidict-core
tokenizers
];
pythonImportsCheck = [ "sudachipy" ];
passthru = {
inherit (sudachi-rs) updateScript;
tests = {
pytest = sudachipy.overridePythonAttrs (_: {
doCheck = true;
# avoid catchConflicts of sudachipy
# we don't need to install this package since it is just a test
dontInstall = true;
});
};
};
meta = sudachi-rs.meta // {
homepage = "https://github.com/WorksApplications/sudachi.rs/tree/develop/python";
mainProgram = "sudachipy";
};
}