1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cargo,
8 pkg-config,
9 rustPlatform,
10 rustc,
11
12 # buildInputs
13 openssl,
14 stdenv,
15 libiconv,
16}:
17
18buildPythonPackage rec {
19 pname = "hf-transfer";
20 version = "0.1.9";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "huggingface";
25 repo = "hf_transfer";
26 tag = "v${version}";
27 hash = "sha256-mcU3YuJVfuwBvtLfqceV3glcJcpjSX7M3VjvbvLCxZg=";
28 };
29
30 cargoDeps = rustPlatform.fetchCargoVendor {
31 inherit pname version src;
32 hash = "sha256-O4aKqVSShFpt8mdZkY3WV55j9CIczRSRkIMC7dJoGv0=";
33 };
34
35 build-system = [
36 cargo
37 pkg-config
38 rustPlatform.cargoSetupHook
39 rustPlatform.maturinBuildHook
40 rustc
41 ];
42
43 buildInputs = [
44 openssl
45 ]
46 ++ lib.optionals stdenv.hostPlatform.isDarwin [
47 libiconv
48 ];
49
50 pythonImportsCheck = [ "hf_transfer" ];
51
52 env = {
53 OPENSSL_NO_VENDOR = true;
54 };
55
56 meta = {
57 description = "High speed download python library";
58 homepage = "https://github.com/huggingface/hf_transfer";
59 changelog = "https://github.com/huggingface/hf_transfer/releases/tag/v${version}";
60 license = lib.licenses.asl20;
61 maintainers = with lib.maintainers; [ GaetanLepage ];
62 };
63}