mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 21:53:32 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
103 lines
1.9 KiB
Nix
103 lines
1.9 KiB
Nix
{
|
|
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,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "thinc";
|
|
version = "8.3.0";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
hash = "sha256-6zvtVPXADsmt2qogjFHM+gWUg9cxQM1RWqMzc3Fcblk=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# 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
|
|
substituteInPlace setup.cfg \
|
|
--replace-fail "numpy>=2.0.1,<2.1.0" numpy
|
|
'';
|
|
|
|
build-system = [
|
|
blis
|
|
cymem
|
|
cython_0
|
|
murmurhash
|
|
numpy
|
|
preshed
|
|
setuptools
|
|
];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
Accelerate
|
|
CoreFoundation
|
|
CoreGraphics
|
|
CoreVideo
|
|
];
|
|
|
|
dependencies = [
|
|
blis
|
|
catalogue
|
|
confection
|
|
cymem
|
|
murmurhash
|
|
numpy
|
|
preshed
|
|
pydantic
|
|
srsly
|
|
wasabi
|
|
] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions ];
|
|
|
|
nativeCheckInputs = [
|
|
hypothesis
|
|
mock
|
|
pytestCheckHook
|
|
];
|
|
|
|
preCheck = ''
|
|
# avoid local paths, relative imports wont resolve correctly
|
|
mv thinc/tests tests
|
|
rm -r thinc
|
|
'';
|
|
|
|
pythonImportsCheck = [ "thinc" ];
|
|
|
|
meta = with lib; {
|
|
description = "Library for NLP machine learning";
|
|
homepage = "https://github.com/explosion/thinc";
|
|
changelog = "https://github.com/explosion/thinc/releases/tag/v${version}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ aborsu ];
|
|
};
|
|
}
|