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