2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
rustPlatform,
|
|
|
|
cmake,
|
|
|
|
libiconv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
typing-extensions,
|
|
|
|
jemalloc,
|
|
|
|
rust-jemalloc-sys,
|
|
|
|
darwin,
|
2022-04-15 01:41:22 +00:00
|
|
|
}:
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
let
|
2023-11-16 04:20:00 +00:00
|
|
|
rust-jemalloc-sys' = rust-jemalloc-sys.override {
|
2024-06-05 15:53:02 +00:00
|
|
|
jemalloc = jemalloc.override { disableInitExecTls = true; };
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
in
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "polars";
|
|
|
|
version = "0.20.15";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pola-rs";
|
|
|
|
repo = "polars";
|
|
|
|
rev = "refs/tags/py-${version}";
|
|
|
|
hash = "sha256-N/VIi0s5unYWqlR5Mpaq9cqXl2ccbzWPuOtE2UbmQw8=";
|
|
|
|
};
|
2023-11-16 04:20:00 +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
|
|
|
#sed -i 's/version = "0.18.0"/version = "${version}"/g' Cargo.lock
|
2022-04-15 01:41:22 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
buildAndTestSubdir = "py-polars";
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
# Revisit this whenever package or Rust is upgraded
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [ typing-extensions ];
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
# trick taken from the polars repo since there seems to be a problem
|
|
|
|
# with simd enabled with our stable rust (instead of nightly).
|
2024-06-05 15:53:02 +00:00
|
|
|
maturinBuildFlags = [
|
|
|
|
"--no-default-features"
|
|
|
|
"--features=all"
|
|
|
|
];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs =
|
|
|
|
[
|
|
|
|
# needed for libz-ng-sys
|
|
|
|
# TODO: use pkgs.zlib-ng
|
|
|
|
cmake
|
|
|
|
]
|
|
|
|
++ (with rustPlatform; [
|
|
|
|
cargoSetupHook
|
|
|
|
maturinBuildHook
|
|
|
|
]);
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ rust-jemalloc-sys' ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
|
|
];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
# nativeCheckInputs = [
|
2022-04-15 01:41:22 +00:00
|
|
|
# pytestCheckHook
|
|
|
|
# fixtures
|
|
|
|
# graphviz
|
|
|
|
# matplotlib
|
|
|
|
# networkx
|
|
|
|
# numpy
|
|
|
|
# pydot
|
|
|
|
# ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "polars" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
meta = with lib; {
|
2024-01-02 11:29:13 +00:00
|
|
|
description = "Fast multi-threaded DataFrame library";
|
2022-04-15 01:41:22 +00:00
|
|
|
homepage = "https://github.com/pola-rs/polars";
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/pola-rs/polars/releases/tag/py-${version}";
|
2022-04-15 01:41:22 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ happysalada ];
|
|
|
|
};
|
|
|
|
}
|