2022-04-15 01:41:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, rustPlatform
|
2023-11-16 04:20:00 +00:00
|
|
|
, cmake
|
2022-04-15 01:41:22 +00:00
|
|
|
, libiconv
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchFromGitHub
|
2023-01-11 07:51:40 +00:00
|
|
|
, typing-extensions
|
2023-11-16 04:20:00 +00:00
|
|
|
, jemalloc
|
|
|
|
, rust-jemalloc-sys
|
2023-07-15 17:15:38 +00:00
|
|
|
, darwin
|
2022-04-15 01:41:22 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "polars";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "0.19.12";
|
2023-05-24 13:37:59 +00:00
|
|
|
rootSource = fetchFromGitHub {
|
|
|
|
owner = "pola-rs";
|
|
|
|
repo = "polars";
|
|
|
|
rev = "refs/tags/py-${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-6tn3Q6oZfMjgQ5l5xCFnGimLSDLOjTWCW5uEbi6yFZY=";
|
|
|
|
};
|
|
|
|
rust-jemalloc-sys' = rust-jemalloc-sys.override {
|
|
|
|
jemalloc = jemalloc.override {
|
|
|
|
disableInitExecTls = true;
|
|
|
|
};
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version;
|
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";
|
|
|
|
|
|
|
|
src = rootSource;
|
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
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"jsonpath_lib-0.3.0" = "sha256-NKszYpDGG8VxfZSMbsTlzcMGFHBOUeFojNw4P2wM3qk=";
|
|
|
|
};
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
sourceRoot = "source/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-01-02 11:29:13 +00:00
|
|
|
propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [
|
|
|
|
typing-extensions
|
|
|
|
];
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
# needed for libz-ng-sys
|
|
|
|
# TODO: use pkgs.zlib-ng
|
|
|
|
cmake
|
|
|
|
] ++ (with rustPlatform; [
|
|
|
|
cargoSetupHook
|
|
|
|
maturinBuildHook
|
|
|
|
]);
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
rust-jemalloc-sys'
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2023-07-15 17:15:38 +00:00
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
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-01-02 11:29:13 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"polars"
|
|
|
|
];
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|