2022-04-15 01:41:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, rustPlatform
|
|
|
|
, libiconv
|
|
|
|
, fetchzip
|
2023-01-11 07:51:40 +00:00
|
|
|
, typing-extensions
|
2022-04-15 01:41:22 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "polars";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "0.15.13";
|
2022-04-15 01:41:22 +00:00
|
|
|
rootSource = fetchzip {
|
2023-01-11 07:51:40 +00:00
|
|
|
url = "https://github.com/pola-rs/${pname}/archive/refs/tags/py-${version}.tar.gz";
|
|
|
|
sha256 = "sha256-bk2opNLN3L+fkzXVfUU5O37UmA27ijmnAElCHjsuI+o=";
|
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
|
|
|
|
|
|
|
# Cargo.lock files is sometimes behind actual release which throws an error,
|
|
|
|
# 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 = ''
|
|
|
|
cd py-polars
|
2023-01-11 07:51:40 +00:00
|
|
|
sed -i 's/version = "0.15.11"/version = "${version}"/g' Cargo.lock
|
2022-04-15 01:41:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
src = rootSource;
|
|
|
|
preBuild = ''
|
|
|
|
cd py-polars
|
|
|
|
'';
|
|
|
|
name = "${pname}-${version}";
|
2023-01-11 07:51:40 +00:00
|
|
|
sha256 = "sha256-u7ascftUPz8K+gWwjjxdXXFJf++M+8P9QE/KVJkO5DM=";
|
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;
|
|
|
|
|
|
|
|
propagatedBuildInputs = if pythonOlder "3.10" then [ typing-extensions ] else [];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "polars" ];
|
|
|
|
# checkInputs = [
|
|
|
|
# pytestCheckHook
|
|
|
|
# fixtures
|
|
|
|
# graphviz
|
|
|
|
# matplotlib
|
|
|
|
# networkx
|
|
|
|
# numpy
|
|
|
|
# pydot
|
|
|
|
# ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-01-11 07:51:40 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
|
2022-04-15 01:41:22 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|