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