Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at lanzaboote 77 lines 2.0 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, pythonOlder 5, rustPlatform 6, libiconv 7, fetchFromGitHub 8, typing-extensions 9, rust-jemalloc-sys 10, darwin 11}: 12let 13 pname = "polars"; 14 version = "0.18.13"; 15 rootSource = fetchFromGitHub { 16 owner = "pola-rs"; 17 repo = "polars"; 18 rev = "refs/tags/py-${version}"; 19 hash = "sha256-kV30r2wmswpCUmMRaFsCOeRrlTN5/PU0ogaU2JIHq0E="; 20 }; 21in 22buildPythonPackage { 23 inherit pname version; 24 format = "pyproject"; 25 disabled = pythonOlder "3.6"; 26 src = rootSource; 27 28 # Cargo.lock file is sometimes behind actual release which throws an error, 29 # thus the `sed` command 30 # Make sure to check that the right substitutions are made when updating the package 31 preBuild = '' 32 cd py-polars 33 #sed -i 's/version = "0.18.0"/version = "${version}"/g' Cargo.lock 34 ''; 35 36 cargoDeps = rustPlatform.importCargoLock { 37 lockFile = ./Cargo.lock; 38 outputHashes = { 39 "arrow2-0.17.3" = "sha256-pM6lNjMCpUzC98IABY+M23lbLj0KMXDefgBMjUPjDlg="; 40 "jsonpath_lib-0.3.0" = "sha256-NKszYpDGG8VxfZSMbsTlzcMGFHBOUeFojNw4P2wM3qk="; 41 "simd-json-0.10.0" = "sha256-0q/GhL7PG5SLgL0EETPqe8kn6dcaqtyL+kLU9LL+iQs="; 42 }; 43 }; 44 cargoRoot = "py-polars"; 45 46 # Revisit this whenever package or Rust is upgraded 47 RUSTC_BOOTSTRAP = 1; 48 49 propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [ typing-extensions ]; 50 51 nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ]; 52 53 buildInputs = [ 54 rust-jemalloc-sys 55 ] ++ lib.optionals stdenv.isDarwin [ 56 libiconv 57 darwin.apple_sdk.frameworks.Security 58 ]; 59 60 pythonImportsCheck = [ "polars" ]; 61 # nativeCheckInputs = [ 62 # pytestCheckHook 63 # fixtures 64 # graphviz 65 # matplotlib 66 # networkx 67 # numpy 68 # pydot 69 # ]; 70 71 meta = with lib; { 72 description = "Fast multi-threaded DataFrame library in Rust | Python | Node.js "; 73 homepage = "https://github.com/pola-rs/polars"; 74 license = licenses.asl20; 75 maintainers = with maintainers; [ happysalada ]; 76 }; 77}