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 [
45 openssl
46 ]
47 ++ lib.optionals stdenv.hostPlatform.isDarwin [
48 libiconv
49 ];
50
51 pythonImportsCheck = [ "hf_transfer" ];
52
53 env = {
54 OPENSSL_NO_VENDOR = true;
55 };
56
57 meta = {
58 description = "High speed download python library";
59 homepage = "https://github.com/huggingface/hf_transfer";
60 changelog = "https://github.com/huggingface/hf_transfer/releases/tag/v${version}";
61 license = lib.licenses.asl20;
62 maintainers = with lib.maintainers; [ GaetanLepage ];
63 };
64}