diff --git a/pkgs/development/python-modules/spacy/default.nix b/pkgs/development/python-modules/spacy/default.nix index a773e1cb7a93..b961fe45942e 100644 --- a/pkgs/development/python-modules/spacy/default.nix +++ b/pkgs/development/python-modules/spacy/default.nix @@ -2,38 +2,47 @@ lib, stdenv, buildPythonPackage, - callPackage, - catalogue, + fetchFromGitHub, + + # build-system cymem, cython_0, - fetchPypi, - git, - hypothesis, + murmurhash, + numpy, + preshed, + thinc, + + # dependencies + catalogue, jinja2, langcodes, - mock, - murmurhash, - nix-update, - nix, - numpy, packaging, - preshed, pydantic, - pytestCheckHook, - pythonOlder, requests, setuptools, spacy-legacy, spacy-loggers, - spacy-lookups-data, - spacy-transformers, srsly, - thinc, tqdm, typer, wasabi, weasel, + + # optional-dependencies + spacy-transformers, + spacy-lookups-data, + + # tests + pytestCheckHook, + hypothesis, + mock, + + # passthru writeScript, + git, + nix, + nix-update, + callPackage, }: buildPythonPackage rec { @@ -41,17 +50,13 @@ buildPythonPackage rec { version = "3.8.5"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-OLyLh3+yT0FJBf8XliADFgfNMf5vkA1noGcwFCcVZRw="; + src = fetchFromGitHub { + owner = "explosion"; + repo = "spaCy"; + tag = "release-v${version}"; + hash = "sha256-rgMstGSscUBACA5+veXD9H/lHuvWKs7hJ6hz6aKOB/0="; }; - postPatch = '' - # unpin numpy, cannot use pythonRelaxDeps because it's in build-system - substituteInPlace pyproject.toml setup.cfg \ - --replace-fail ",<2.1.0" "" - ''; - build-system = [ cymem cython_0 @@ -85,17 +90,17 @@ buildPythonPackage rec { weasel ]; + optional-dependencies = { + transformers = [ spacy-transformers ]; + lookups = [ spacy-lookups-data ]; + }; + nativeCheckInputs = [ pytestCheckHook hypothesis mock ]; - optional-dependencies = { - transformers = [ spacy-transformers ]; - lookups = [ spacy-lookups-data ]; - }; - # Fixes ModuleNotFoundError when running tests on Cythonized code. See #255262 preCheck = '' cd $out @@ -118,8 +123,8 @@ buildPythonPackage rec { set -eou pipefail PATH=${ lib.makeBinPath [ - nix git + nix nix-update ] } @@ -132,12 +137,14 @@ buildPythonPackage rec { tests.annotation = callPackage ./annotation-test { }; }; - meta = with lib; { + meta = { description = "Industrial-strength Natural Language Processing (NLP)"; homepage = "https://github.com/explosion/spaCy"; changelog = "https://github.com/explosion/spaCy/releases/tag/release-v${version}"; - license = licenses.mit; + license = lib.licenses.mit; maintainers = [ ]; mainProgram = "spacy"; + # Cython.Compiler.Errors.CompileError: spacy/ml/parser_model.pyx + broken = true; }; }