python312Packages.tokenizers: 0.21.0 -> 0.21.1 (#389517)

This commit is contained in:
Nick Cao
2025-03-14 21:26:31 -04:00
committed by GitHub

View File

@@ -24,6 +24,7 @@
pytestCheckHook, pytestCheckHook,
requests, requests,
tiktoken, tiktoken,
writableTmpDirAsHomeHook,
}: }:
let let
@@ -70,16 +71,24 @@ let
in in
buildPythonPackage rec { buildPythonPackage rec {
pname = "tokenizers"; pname = "tokenizers";
version = "0.21.0"; version = "0.21.1";
pyproject = true; pyproject = true;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "huggingface"; owner = "huggingface";
repo = "tokenizers"; repo = "tokenizers";
tag = "v${version}"; tag = "v${version}";
hash = "sha256-G65XiVlvJXOC9zqcVr9vWamUnpC0aa4kyYkE2v1K2iY="; hash = "sha256-3S7ZCaZnnwyNjoZ4Y/q3ngQE2MIm2iyCCjYAkdMVG2A=";
}; };
# TestUnigram.test_continuing_prefix_trainer_mismatch fails with:
# Exception: No such file or directory (os error 2)
# Fix submitted upstream: https://github.com/huggingface/tokenizers/pull/1747
postPatch = ''
substituteInPlace tests/bindings/test_trainers.py \
--replace-fail '"data/' '"tests/data/'
'';
cargoDeps = rustPlatform.fetchCargoVendor { cargoDeps = rustPlatform.fetchCargoVendor {
inherit inherit
pname pname
@@ -87,7 +96,7 @@ buildPythonPackage rec {
src src
sourceRoot sourceRoot
; ;
hash = "sha256-jj5nuwxlfJm1ugYd5zW+wjyczOZHWCmRGYpmiMDqFlk="; hash = "sha256-I7LlBmeVY2rWI0ta6x311iAurQKuutsClrbUgkt9xWk=";
}; };
sourceRoot = "${src.name}/bindings/python"; sourceRoot = "${src.name}/bindings/python";
@@ -115,18 +124,16 @@ buildPythonPackage rec {
pytestCheckHook pytestCheckHook
requests requests
tiktoken tiktoken
writableTmpDirAsHomeHook
]; ];
postUnpack = '' postUnpack =
# Add data files for tests, otherwise tests attempt network access # Add data files for tests, otherwise tests attempt network access
''
mkdir $sourceRoot/tests/data mkdir $sourceRoot/tests/data
ln -s ${test-data}/* $sourceRoot/tests/data/ ln -s ${test-data}/* $sourceRoot/tests/data/
''; '';
preCheck = ''
export HOME=$(mktemp -d);
'';
pythonImportsCheck = [ "tokenizers" ]; pythonImportsCheck = [ "tokenizers" ];
disabledTests = [ disabledTests = [