about summary refs log tree commit diff
path: root/pkgs/development/python-modules/polars/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/polars/default.nix')
-rw-r--r--pkgs/development/python-modules/polars/default.nix102
1 files changed, 50 insertions, 52 deletions
diff --git a/pkgs/development/python-modules/polars/default.nix b/pkgs/development/python-modules/polars/default.nix
index 4d1d1c0f14d06..c6aca67e2859b 100644
--- a/pkgs/development/python-modules/polars/default.nix
+++ b/pkgs/development/python-modules/polars/default.nix
@@ -1,38 +1,37 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, pythonOlder
-, rustPlatform
-, cmake
-, libiconv
-, fetchFromGitHub
-, typing-extensions
-, jemalloc
-, rust-jemalloc-sys
-, darwin
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  pythonOlder,
+  rustPlatform,
+  cmake,
+  libiconv,
+  fetchFromGitHub,
+  typing-extensions,
+  jemalloc,
+  rust-jemalloc-sys,
+  darwin,
 }:
+
 let
-  pname = "polars";
-  version = "0.20.15";
-  rootSource = fetchFromGitHub {
-    owner = "pola-rs";
-    repo = "polars";
-    rev = "refs/tags/py-${version}";
-    hash = "sha256-N/VIi0s5unYWqlR5Mpaq9cqXl2ccbzWPuOtE2UbmQw8=";
-  };
   rust-jemalloc-sys' = rust-jemalloc-sys.override {
-    jemalloc = jemalloc.override {
-      disableInitExecTls = true;
-    };
+    jemalloc = jemalloc.override { disableInitExecTls = true; };
   };
 in
-buildPythonPackage {
-  inherit pname version;
+
+buildPythonPackage rec {
+  pname = "polars";
+  version = "0.20.15";
   pyproject = true;
 
   disabled = pythonOlder "3.8";
 
-  src = rootSource;
+  src = fetchFromGitHub {
+    owner = "pola-rs";
+    repo = "polars";
+    rev = "refs/tags/py-${version}";
+    hash = "sha256-N/VIi0s5unYWqlR5Mpaq9cqXl2ccbzWPuOtE2UbmQw8=";
+  };
 
   # Cargo.lock file is sometimes behind actual release which throws an error,
   # thus the `sed` command
@@ -41,41 +40,42 @@ buildPythonPackage {
     #sed -i 's/version = "0.18.0"/version = "${version}"/g' Cargo.lock
   '';
 
-  cargoDeps = rustPlatform.importCargoLock {
-    lockFile = ./Cargo.lock;
-  };
+  cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
 
   buildAndTestSubdir = "py-polars";
 
   # Revisit this whenever package or Rust is upgraded
   RUSTC_BOOTSTRAP = 1;
 
-  propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [
-    typing-extensions
-  ];
+  propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [ typing-extensions ];
 
   # trick taken from the polars repo since there seems to be a problem
   # with simd enabled with our stable rust (instead of nightly).
-  maturinBuildFlags = [ "--no-default-features" "--features=all" ];
+  maturinBuildFlags = [
+    "--no-default-features"
+    "--features=all"
+  ];
 
   dontUseCmakeConfigure = true;
 
-  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
-  ];
+  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
+    ];
 
   # nativeCheckInputs = [
   #   pytestCheckHook
@@ -87,9 +87,7 @@ buildPythonPackage {
   #   pydot
   # ];
 
-  pythonImportsCheck = [
-    "polars"
-  ];
+  pythonImportsCheck = [ "polars" ];
 
   meta = with lib; {
     description = "Fast multi-threaded DataFrame library";