1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 filelock,
11 fsspec,
12 hf-xet,
13 packaging,
14 pyyaml,
15 requests,
16 tqdm,
17 typing-extensions,
18
19 # optional-dependencies
20 # cli
21 inquirerpy,
22 # inference
23 aiohttp,
24 # torch
25 torch,
26 safetensors,
27 # hf_transfer
28 hf-transfer,
29 # fastai
30 toml,
31 fastai,
32 fastcore,
33 # tensorflow
34 tensorflow,
35 pydot,
36 graphviz,
37 # tensorflow-testing
38 keras,
39
40 # tests
41 versionCheckHook,
42}:
43
44buildPythonPackage rec {
45 pname = "huggingface-hub";
46 version = "0.35.0";
47 pyproject = true;
48
49 src = fetchFromGitHub {
50 owner = "huggingface";
51 repo = "huggingface_hub";
52 tag = "v${version}";
53 hash = "sha256-b7zuqY1d2wBjqyQ3nxhXg33limR1Nq3dGS2YoY5xcsQ=";
54 };
55
56 build-system = [ setuptools ];
57
58 dependencies = [
59 filelock
60 fsspec
61 hf-xet
62 packaging
63 pyyaml
64 requests
65 tqdm
66 typing-extensions
67 ];
68
69 optional-dependencies = {
70 all = [
71
72 ];
73 cli = [
74 inquirerpy
75 ];
76 inference = [
77 aiohttp
78 ];
79 torch = [
80 torch
81 safetensors
82 ]
83 ++ safetensors.optional-dependencies.torch;
84 hf_transfer = [
85 hf-transfer
86 ];
87 fastai = [
88 toml
89 fastai
90 fastcore
91 ];
92 tensorflow = [
93 tensorflow
94 pydot
95 graphviz
96 ];
97 tensorflow-testing = [
98 tensorflow
99 keras
100 ];
101 hf_xet = [
102 hf-xet
103 ];
104 };
105
106 nativeCheckInputs = [
107 versionCheckHook
108 ];
109 versionCheckProgramArg = "version";
110
111 pythonImportsCheck = [ "huggingface_hub" ];
112
113 meta = {
114 description = "Download and publish models and other files on the huggingface.co hub";
115 mainProgram = "hf";
116 homepage = "https://github.com/huggingface/huggingface_hub";
117 changelog = "https://github.com/huggingface/huggingface_hub/releases/tag/v${version}";
118 license = lib.licenses.asl20;
119 maintainers = with lib.maintainers; [
120 GaetanLepage
121 osbm
122 ];
123 };
124}