1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, rustPlatform
6, libiconv
7, fetchzip
8}:
9let
10 pname = "polars";
11 version = "0.13.19";
12 rootSource = fetchzip {
13 url = "https://github.com/pola-rs/${pname}/archive/refs/tags/py-polars-v${version}.tar.gz";
14 sha256 = "sha256-JOHjxTTPzS9Dd/ODp4r0ebU9hEonxrbjURJoq0BQCyI=";
15 };
16in
17buildPythonPackage {
18 inherit pname version;
19 format = "pyproject";
20 disabled = pythonOlder "3.6";
21 src = rootSource;
22 preBuild = ''
23 cd py-polars
24 '';
25
26 cargoDeps = rustPlatform.fetchCargoTarball {
27 src = rootSource;
28 preBuild = ''
29 cd py-polars
30 '';
31 name = "${pname}-${version}";
32 sha256 = "sha256-KEt8lITY4El2afuh2cxnrDkXGN3MZgfKQU3Pe2jECF0=";
33 };
34 cargoRoot = "py-polars";
35
36 nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
37
38 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
39
40 pythonImportsCheck = [ "polars" ];
41 # checkInputs = [
42 # pytestCheckHook
43 # fixtures
44 # graphviz
45 # matplotlib
46 # networkx
47 # numpy
48 # pydot
49 # ];
50
51 meta = with lib; {
52 # Adding cmake to nativeBuildInputs and using `dontUseCmakeConfigure = true;`
53 # The following error still happens
54
55 # Compiling arrow2 v0.10.1 (https://github.com/ritchie46/arrow2?branch=polars#da703ae3)
56 # error[E0554]: `#![feature]` may not be used on the stable release channel
57 # --> /build/polars-0.13.19-vendor.tar.gz/arrow2/src/lib.rs:8:39
58 # |
59 # 8 | #![cfg_attr(feature = "simd", feature(portable_simd))]
60 # | ^^^^^^^^^^^^^
61 # error: aborting due to previous error
62 # For more information about this error, try `rustc --explain E0554`.
63 # error: could not compile `arrow2` due to 2 previous errors
64 # warning: build failed, waiting for other jobs to finish...
65 # maturin failed
66 # Caused by: Failed to build a native library through cargo
67 # Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml -j 8 --frozen --target x86_64-unknown-linux-gnu --release --lib -- -C link-arg=-s`
68 # error: builder for '/nix/store/qfnqi5hs3x4xdb6d4f6rpaf63n1w74yn-python3.10-polars-0.13.19.drv' failed with exit code 1;
69 # last 10 log lines:
70 # > error: aborting due to previous error
71 # >
72 # >
73 # > For more information about this error, try `rustc --explain E0554`.
74 # >
75 # > error: could not compile `arrow2` due to 2 previous errors
76 # > warning: build failed, waiting for other jobs to finish...
77 # > maturin failed
78 # > Caused by: Failed to build a native library through cargo
79 # > Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml -j 8 --frozen --target x86_64-unknown-linux-gnu --release --lib -- -C link-arg=-s`
80 # For full logs, run 'nix log /nix/store/qfnqi5hs3x4xdb6d4f6rpaf63n1w74yn-python3.10-polars-0.13.19.drv'.
81 broken = true;
82 description = "Fast multi-threaded DataFrame library in Rust | Python | Node.js ";
83 homepage = "https://github.com/pola-rs/polars";
84 license = licenses.asl20;
85 maintainers = with maintainers; [ happysalada ];
86 };
87}