Loading
+25 −21
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
  mock,
  murmurhash,
  numpy,
  plac,
  preshed,
  pydantic,
  pytestCheckHook,
@@ -24,51 +23,59 @@
  pythonOlder,
  setuptools,
  srsly,
  tqdm,
  typing-extensions,
  wasabi,
}:

buildPythonPackage rec {
  pname = "thinc";
  version = "8.2.3";
  format = "setuptools";
  version = "8.3.0";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-9a/FIikSqAvai9zslYNiorpTjXAn3I22FUhF0oWdynY=";
    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 "preshed>=3.0.2,<3.1.0" "preshed"
      --replace-fail "numpy>=2.0.1,<2.1.0" numpy
  '';

  nativeBuildInputs = [ setuptools ];
  build-system = [
    blis
    cymem
    cython_0
    murmurhash
    numpy
    preshed
    setuptools
  ];

  buildInputs =
    [ cython_0 ]
    ++ lib.optionals stdenv.isDarwin [
  buildInputs = lib.optionals stdenv.isDarwin [
    Accelerate
    CoreFoundation
    CoreGraphics
    CoreVideo
  ];

  propagatedBuildInputs = [
  dependencies = [
    blis
    catalogue
    confection
    cymem
    murmurhash
    numpy
    plac
    preshed
    pydantic
    srsly
    tqdm
    wasabi
  ] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions ];

@@ -78,10 +85,7 @@ buildPythonPackage rec {
    pytestCheckHook
  ];

  # Add native extensions.
  preCheck = ''
    export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH

    # avoid local paths, relative imports wont resolve correctly
    mv thinc/tests tests
    rm -r thinc