at master 2.7 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 rustPlatform, 6 pytestCheckHook, 7 geoarrow-types, 8 pyarrow, 9 numpy, 10 pandas, 11}: 12let 13 version = "0.5.1"; 14 15 src = fetchFromGitHub { 16 owner = "kylebarron"; 17 repo = "arro3"; 18 tag = "py-v${version}"; 19 hash = "sha256-RTr+mf5slfxxvXp9cwPuy08AZUswPtIIRz+vngdg/k0="; 20 }; 21 22 cargoDeps = rustPlatform.fetchCargoVendor { 23 inherit version src; 24 pname = "arro3-vendor"; 25 hash = "sha256-YQA8Z86Ul8yAHncMgYrGmNe10KSpubHjaokCjaqTAxo="; 26 }; 27 28 commonMeta = { 29 homepage = "https://github.com/kylebarron/arro3"; 30 changelog = "https://github.com/kylebarron/arro3/releases/tag/py-v${version}"; 31 license = lib.licenses.asl20; 32 maintainers = [ lib.maintainers.mslingsby ]; 33 }; 34 35 buildArro3Package = 36 { 37 pname, 38 subdir, 39 description, 40 pythonImportsCheck, 41 dependencies ? [ ], 42 }: 43 buildPythonPackage rec { 44 inherit 45 pname 46 version 47 src 48 cargoDeps 49 dependencies 50 pythonImportsCheck 51 ; 52 pyproject = true; 53 54 sourceRoot = "${src.name}/${subdir}"; 55 cargoRoot = ".."; 56 57 nativeBuildInputs = with rustPlatform; [ 58 cargoSetupHook 59 maturinBuildHook 60 ]; 61 62 env = { 63 CARGO_TARGET_DIR = "./target"; 64 }; 65 66 # Avoid infinite recursion in tests. 67 # arro3-core tests depends on arro3-compute and arro3-compute depends on arro3-core 68 passthru.tests = { inherit arro3-tests; }; 69 70 meta = commonMeta // { 71 inherit description; 72 }; 73 }; 74 75 arro3-core = buildArro3Package { 76 pname = "arro3-core"; 77 subdir = "arro3-core"; 78 description = "Core library for representing Arrow data in Python"; 79 pythonImportsCheck = [ "arro3.core" ]; 80 }; 81 82 arro3-compute = buildArro3Package { 83 pname = "arro3-compute"; 84 subdir = "arro3-compute"; 85 description = "Rust-based compute kernels for Arrow in Python"; 86 pythonImportsCheck = [ "arro3.compute" ]; 87 dependencies = [ arro3-core ]; 88 }; 89 90 arro3-io = buildArro3Package { 91 pname = "arro3-io"; 92 subdir = "arro3-io"; 93 description = "Rust-based readers and writers for Arrow in Python"; 94 pythonImportsCheck = [ "arro3.io" ]; 95 dependencies = [ arro3-core ]; 96 }; 97 98 arro3-tests = buildPythonPackage { 99 pname = "arro3-tests"; 100 version = arro3-core.version; 101 102 format = "other"; 103 dontBuild = true; 104 dontInstall = true; 105 106 inherit src; 107 108 nativeCheckInputs = [ 109 pytestCheckHook 110 geoarrow-types 111 pandas 112 pyarrow 113 numpy 114 arro3-core 115 arro3-compute 116 arro3-io 117 ]; 118 }; 119in 120{ 121 inherit arro3-core arro3-io arro3-compute; 122}