2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
Accelerate,
|
|
|
|
blis,
|
|
|
|
buildPythonPackage,
|
|
|
|
catalogue,
|
|
|
|
confection,
|
|
|
|
CoreFoundation,
|
|
|
|
CoreGraphics,
|
|
|
|
CoreVideo,
|
|
|
|
cymem,
|
|
|
|
cython_0,
|
|
|
|
fetchPypi,
|
|
|
|
hypothesis,
|
|
|
|
mock,
|
|
|
|
murmurhash,
|
|
|
|
numpy,
|
|
|
|
preshed,
|
|
|
|
pydantic,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
|
|
|
srsly,
|
|
|
|
typing-extensions,
|
|
|
|
wasabi,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "thinc";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "8.3.0";
|
|
|
|
pyproject = true;
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-6zvtVPXADsmt2qogjFHM+gWUg9cxQM1RWqMzc3Fcblk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postPatch = ''
|
2024-09-19 14:19:46 +00:00
|
|
|
# As per https://github.com/explosion/thinc/releases/tag/release-v8.3.0 no
|
|
|
|
# code changes were required for NumPy 2.0. Thus Thinc should be compatible
|
|
|
|
# with NumPy 1.0 and 2.0.
|
|
|
|
substituteInPlace pyproject.toml setup.cfg \
|
|
|
|
--replace-fail "numpy>=2.0.0,<2.1.0" numpy
|
2023-11-16 04:20:00 +00:00
|
|
|
substituteInPlace setup.cfg \
|
2024-09-19 14:19:46 +00:00
|
|
|
--replace-fail "numpy>=2.0.1,<2.1.0" numpy
|
2023-11-16 04:20:00 +00:00
|
|
|
'';
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [
|
|
|
|
blis
|
|
|
|
cymem
|
|
|
|
cython_0
|
|
|
|
murmurhash
|
|
|
|
numpy
|
|
|
|
preshed
|
|
|
|
setuptools
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-09-19 14:19:46 +00:00
|
|
|
Accelerate
|
|
|
|
CoreFoundation
|
|
|
|
CoreGraphics
|
|
|
|
CoreVideo
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
dependencies = [
|
2020-12-25 13:55:36 +00:00
|
|
|
blis
|
|
|
|
catalogue
|
2022-11-02 22:02:43 +00:00
|
|
|
confection
|
2020-12-25 13:55:36 +00:00
|
|
|
cymem
|
|
|
|
murmurhash
|
|
|
|
numpy
|
|
|
|
preshed
|
2022-11-02 22:02:43 +00:00
|
|
|
pydantic
|
2020-12-25 13:55:36 +00:00
|
|
|
srsly
|
|
|
|
wasabi
|
2024-06-05 15:53:02 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2020-04-24 23:36:52 +00:00
|
|
|
hypothesis
|
|
|
|
mock
|
2021-10-06 13:57:05 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
preCheck = ''
|
|
|
|
# avoid local paths, relative imports wont resolve correctly
|
|
|
|
mv thinc/tests tests
|
|
|
|
rm -r thinc
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "thinc" ];
|
2020-06-15 15:56:04 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-11-02 22:02:43 +00:00
|
|
|
description = "Library for NLP machine learning";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/explosion/thinc";
|
2023-11-16 04:20:00 +00:00
|
|
|
changelog = "https://github.com/explosion/thinc/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2021-09-22 15:38:15 +00:00
|
|
|
maintainers = with maintainers; [ aborsu ];
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|