Change:
, sentencepiece , spacy , spacy-pkuseg <del> , spacy-transformers }: </del> <ins> , spacy-transformers , writeScript , stdenv , jq , nix , moreutils }: </ins> let buildModelPackage = { pname, version, sha256, license }: <del> let lang = builtins.substring 0 2 pname; in buildPythonPackage { inherit pname version; src = fetchurl { url = "https://github.com/explosion/spacy-models/releases/download/${pname}-${version}/${pname}-${version}.tar.gz"; inherit sha256; }; </del> <ins> let lang = builtins.substring 0 2 pname; in buildPythonPackage { inherit pname version; src = fetchurl { url = "https://github.com/explosion/spacy-models/releases/download/${pname}-${version}/${pname}-${version}.tar.gz"; inherit sha256; }; propagatedBuildInputs = [ spacy ] ++ lib.optionals (lang == "zh") [ jieba spacy-pkuseg ] ++ lib.optionals (lib.hasSuffix "_trf" pname) [ spacy-transformers ] ++ lib.optionals (lang == "ru") [ pymorphy2 ] ++ lib.optionals (pname == "fr_dep_news_trf") [ sentencepiece ]; postPatch = lib.optionalString (pname == "fr_dep_news_trf") '' substituteInPlace meta.json  --replace "sentencepiece==0.1.91" "sentencepiece>=0.1.91" ''; pythonImportsCheck = [ pname ]; </ins> <del> propagatedBuildInputs = [ spacy ] ++ lib.optionals (lang == "zh") [ jieba spacy-pkuseg ] ++ lib.optionals (lib.hasSuffix "_trf" pname) [ spacy-transformers ] ++ lib.optionals (lang == "ru") [ pymorphy2 ] ++ lib.optionals (pname == "fr_dep_news_trf") [ sentencepiece ]; </del> <ins> passthru.updateScript = writeScript "update-spacy-models" '' #!${stdenv.shell} set -eou pipefail PATH=${lib.makeBinPath [ jq nix moreutils ]} </ins> <del> postPatch = lib.optionalString (pname == "fr_dep_news_trf") '' substituteInPlace meta.json  --replace "sentencepiece==0.1.91" "sentencepiece>=0.1.91" ''; </del> <ins> IFS=. read -r major minor patch <<<"${spacy.version}" spacyVersion="$(echo "$major.$minor.0")" </ins> <del> pythonImportsCheck = [ pname ]; </del> <ins> pushd pkgs/development/python-modules/spacy/ || exit </ins> <del> meta = with lib; { description = "Models for the spaCy NLP library"; homepage    = "https://github.com/explosion/spacy-models"; license     = licenses.${license}; maintainers = with maintainers; [ rvl ]; </del> <ins> jq -r '.[] | .pname' models.json | while IFS= read -r pname; do if [ "$(jq --arg pname "$pname" -r '.[] | select(.pname == $pname) | .version' models.json)" == "$spacyVersion" ]; then continue fi newHash="$(nix-prefetch-url "https://github.com/explosion/spacy-models/releases/download/$pname-$spacyVersion/$pname-$spacyVersion.tar.gz")" jq --arg newHash "$newHash" --arg pname "$pname" --arg spacyVersion "$spacyVersion"  '[(.[] | select(.pname != $pname)), (.[] | select(.pname == $pname) | .sha256 = $newHash | .version = $spacyVersion)] | sort_by(.pname)'  models.json | sponge models.json done popd || exit ''; meta = with lib; { description = "Models for the spaCy NLP library"; homepage = "https://github.com/explosion/spacy-models"; license = licenses.${license}; maintainers = with maintainers; [ rvl ]; }; </ins> }; <del> }; </del> makeModelSet = models: with lib; listToAttrs (map (m: nameValuePair m.pname (buildModelPackage m)) models); <del> in makeModelSet (lib.importJSON ./models.json) # cat models.json | jq -r '.[] | @uri "https://github.com/explosion/spacy-models/releases/download/(.pname)-(.version)/(.pname)-(.version).tar.gz"' | xargs -n1 nix-prefetch-url </del> <ins> in makeModelSet (lib.importJSON ./models.json) </ins>

Discussion:
<!-- Note that these are hard requirements --<!-- You can use the "Go to file" functionality on GitHub to find the package Then you can go to the history for this package Find the latest "packagename: oldversion -newversion" commit The "newversion" is the current version of the package --- <!-- Type the name of your package and try to find an open pull request for the package If you find an open pull request, you can review it! There's a high chance that you'll have the new version right away while helping the community! --- name: python310Packages.spacy_models (not found in nix search, but available in REPL) <!-- The current version can be found easily with the same process as above for checking the master branch If an open PR is present for the package, take this version as the current one and link to the PR --current version: 3.3.0 desired version: 3.4.0 <!-- Search your package here: If no maintainer is listed for your package, tag the person that last updated the package --maintainers: Please tag this issue in your PR.