2022-04-15 01:41:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, rustPlatform
|
|
|
|
, libiconv
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchFromGitHub
|
2023-01-11 07:51:40 +00:00
|
|
|
, typing-extensions
|
2023-07-15 17:15:38 +00:00
|
|
|
, darwin
|
2022-04-15 01:41:22 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "polars";
|
2023-08-10 07:59:29 +00:00
|
|
|
version = "0.18.13";
|
2023-05-24 13:37:59 +00:00
|
|
|
rootSource = fetchFromGitHub {
|
|
|
|
owner = "pola-rs";
|
|
|
|
repo = "polars";
|
|
|
|
rev = "refs/tags/py-${version}";
|
2023-08-10 07:59:29 +00:00
|
|
|
hash = "sha256-kV30r2wmswpCUmMRaFsCOeRrlTN5/PU0ogaU2JIHq0E=";
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version;
|
|
|
|
format = "pyproject";
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
src = rootSource;
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
# Cargo.lock file is sometimes behind actual release which throws an error,
|
2023-01-11 07:51:40 +00:00
|
|
|
# thus the `sed` command
|
|
|
|
# Make sure to check that the right substitutions are made when updating the package
|
2022-04-15 01:41:22 +00:00
|
|
|
preBuild = ''
|
2023-07-15 17:15:38 +00:00
|
|
|
cd py-polars
|
|
|
|
#sed -i 's/version = "0.18.0"/version = "${version}"/g' Cargo.lock
|
2022-04-15 01:41:22 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2023-08-10 07:59:29 +00:00
|
|
|
"arrow2-0.17.3" = "sha256-pM6lNjMCpUzC98IABY+M23lbLj0KMXDefgBMjUPjDlg=";
|
2023-05-24 13:37:59 +00:00
|
|
|
"jsonpath_lib-0.3.0" = "sha256-NKszYpDGG8VxfZSMbsTlzcMGFHBOUeFojNw4P2wM3qk=";
|
2023-08-10 07:59:29 +00:00
|
|
|
"simd-json-0.10.0" = "sha256-0q/GhL7PG5SLgL0EETPqe8kn6dcaqtyL+kLU9LL+iQs=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
cargoRoot = "py-polars";
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
# Revisit this whenever package or Rust is upgraded
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [ typing-extensions ];
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "polars" ];
|
2023-02-02 18:25:31 +00:00
|
|
|
# nativeCheckInputs = [
|
2022-04-15 01:41:22 +00:00
|
|
|
# pytestCheckHook
|
|
|
|
# fixtures
|
|
|
|
# graphviz
|
|
|
|
# matplotlib
|
|
|
|
# networkx
|
|
|
|
# numpy
|
|
|
|
# pydot
|
|
|
|
# ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Fast multi-threaded DataFrame library in Rust | Python | Node.js ";
|
|
|
|
homepage = "https://github.com/pola-rs/polars";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ happysalada ];
|
|
|
|
};
|
|
|
|
}
|