nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 filelock,
11 fsspec,
12 hf-xet,
13 httpx,
14 packaging,
15 pyyaml,
16 tqdm,
17 typer,
18 typing-extensions,
19
20 # optional-dependencies
21 # torch
22 torch,
23 safetensors,
24 # fastai
25 toml,
26 fastai,
27 fastcore,
28 # mcp
29 mcp,
30
31 # tests
32 versionCheckHook,
33}:
34
35buildPythonPackage (finalAttrs: {
36 pname = "huggingface-hub";
37 version = "1.5.0";
38 pyproject = true;
39
40 src = fetchFromGitHub {
41 owner = "huggingface";
42 repo = "huggingface_hub";
43 tag = "v${finalAttrs.version}";
44 hash = "sha256-XuqZvTu3DuncGpRWXipxtDLY2alY7QVm89ZmpgTdfVo=";
45 };
46
47 build-system = [ setuptools ];
48
49 dependencies = [
50 filelock
51 fsspec
52 hf-xet
53 httpx
54 packaging
55 pyyaml
56 tqdm
57 typer
58 typing-extensions
59 ];
60
61 optional-dependencies = {
62 all = [
63
64 ];
65 torch = [
66 torch
67 safetensors
68 ]
69 ++ safetensors.optional-dependencies.torch;
70 fastai = [
71 toml
72 fastai
73 fastcore
74 ];
75 hf_xet = [
76 hf-xet
77 ];
78 mcp = [
79 mcp
80 ];
81 };
82
83 nativeCheckInputs = [
84 versionCheckHook
85 ];
86 versionCheckProgramArg = "version";
87
88 pythonImportsCheck = [ "huggingface_hub" ];
89
90 meta = {
91 description = "Download and publish models and other files on the huggingface.co hub";
92 mainProgram = "hf";
93 homepage = "https://github.com/huggingface/huggingface_hub";
94 changelog = "https://github.com/huggingface/huggingface_hub/releases/tag/${finalAttrs.src.tag}";
95 license = lib.licenses.asl20;
96 maintainers = with lib.maintainers; [
97 GaetanLepage
98 osbm
99 ];
100 };
101})