about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pylance/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/pylance/default.nix')
-rw-r--r--pkgs/development/python-modules/pylance/default.nix95
1 files changed, 95 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pylance/default.nix b/pkgs/development/python-modules/pylance/default.nix
new file mode 100644
index 0000000000000..d0ef5931a2bb0
--- /dev/null
+++ b/pkgs/development/python-modules/pylance/default.nix
@@ -0,0 +1,95 @@
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  rustPlatform,
+  fetchFromGitHub,
+  darwin,
+  libiconv,
+  pkg-config,
+  protobuf,
+  numpy,
+  pyarrow,
+  ml-dtypes,
+  pandas,
+  pillow,
+  polars,
+  pytestCheckHook,
+  tqdm,
+}:
+
+buildPythonPackage rec {
+  pname = "pylance";
+  version = "0.15.0";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "lancedb";
+    repo = "lance";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-zJ6zyS9DNhlJ1wbXHZRtNMDytF/Beh9DDHKB8S9HFwk=";
+  };
+
+  sourceRoot = "${src.name}/python";
+
+  cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
+
+  postPatch = ''
+    ln -s ${./Cargo.lock} Cargo.lock
+  '';
+
+  nativeBuildInputs = [
+    pkg-config
+    rustPlatform.cargoSetupHook
+  ];
+
+  build-system = [ rustPlatform.maturinBuildHook ];
+
+  buildInputs =
+    [
+      libiconv
+      protobuf
+    ]
+    ++ lib.optionals stdenv.isDarwin (
+      with darwin.apple_sdk.frameworks;
+      [
+        Security
+        SystemConfiguration
+      ]
+    );
+
+  pythonRelaxDeps = [ "pyarrow" ];
+
+  dependencies = [
+    numpy
+    pyarrow
+  ];
+
+  pythonImportsCheck = [ "lance" ];
+
+  nativeCheckInputs = [
+    ml-dtypes
+    pandas
+    pillow
+    polars
+    pytestCheckHook
+    tqdm
+  ];
+
+  preCheck = ''
+    cd python/tests
+  '';
+
+  disabledTests = [
+    # Error during planning: Invalid function 'invert'.
+    "test_polar_scan"
+    "test_simple_predicates"
+  ];
+
+  meta = {
+    description = "Python wrapper for Lance columnar format";
+    homepage = "https://github.com/lancedb/lance";
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ natsukium ];
+  };
+}