add custom huggingface_hub packages (learning from hf-cli's authentication workflow)

This commit is contained in:
Emile Clark-Boman 2025-08-08 20:15:44 +10:00
parent d68132b8fb
commit 7ab29bfe07
3 changed files with 153 additions and 0 deletions

View file

@ -0,0 +1,56 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pkg-config,
rustPlatform,
openssl,
}:
buildPythonPackage rec {
pname = "hf-xet";
version = "1.1.5";
pyproject = true;
src = fetchFromGitHub {
owner = "huggingface";
repo = "xet-core";
tag = "v${version}";
hash = "sha256-udjZcXTH+Mc4Gvj6bSPv1xi4MyXrLeCYav+7CzKWyhY=";
};
sourceRoot = "${src.name}/hf_xet";
cargoDeps = rustPlatform.fetchCargoVendor {
inherit
pname
version
src
sourceRoot
;
hash = "sha256-PTzYubJHFvhq6T3314R4aqBAJlwehOqF7SbpLu4Jo6E=";
};
nativeBuildInputs = [
pkg-config
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
buildInputs = [
openssl
];
env.OPENSSL_NO_VENDOR = 1;
pythonImportsCheck = ["hf_xet"];
# No tests (yet?)
doCheck = false;
meta = {
description = "Xet client tech, used in huggingface_hub";
homepage = "https://github.com/huggingface/xet-core/tree/main/hf_xet";
changelog = "https://github.com/huggingface/xet-core/releases/tag/v${version}";
license = lib.licenses.asl20;
};
}