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
41buildPythonPackage rec {
42 pname = "huggingface-hub";
43 version = "0.34.3";
44 pyproject = true;
45
46 src = fetchFromGitHub {
47 owner = "huggingface";
48 repo = "huggingface_hub";
49 tag = "v${version}";
50 hash = "sha256-rK9Y+hpjk7AOcTPNUcbyqbiEmH6xVG0fy+pUQop422M=";
51 };
52
53 build-system = [ setuptools ];
54
55 dependencies = [
56 filelock
57 fsspec
58 hf-xet
59 packaging
60 pyyaml
61 requests
62 tqdm
63 typing-extensions
64 ];
65
66 optional-dependencies = {
67 all = [
68
69 ];
70 cli = [
71 inquirerpy
72 ];
73 inference = [
74 aiohttp
75 ];
76 torch = [
77 torch
78 safetensors
79 ]
80 ++ safetensors.optional-dependencies.torch;
81 hf_transfer = [
82 hf-transfer
83 ];
84 fastai = [
85 toml
86 fastai
87 fastcore
88 ];
89 tensorflow = [
90 tensorflow
91 pydot
92 graphviz
93 ];
94 tensorflow-testing = [
95 tensorflow
96 keras
97 ];
98 hf_xet = [
99 hf-xet
100 ];
101 };
102
103 # Tests require network access.
104 doCheck = false;
105
106 pythonImportsCheck = [ "huggingface_hub" ];
107
108 meta = {
109 description = "Download and publish models and other files on the huggingface.co hub";
110 mainProgram = "huggingface-cli";
111 homepage = "https://github.com/huggingface/huggingface_hub";
112 changelog = "https://github.com/huggingface/huggingface_hub/releases/tag/v${version}";
113 license = lib.licenses.asl20;
114 maintainers = with lib.maintainers; [ GaetanLepage ];
115 };
116}