{ lib, stdenv, buildPythonPackage, fetchFromGitHub, rustPlatform, # nativeBuildInputs pkg-config, # buildInputs openssl, protobuf, # dependencies numpy, pyarrow, # optional-dependencies torch, # tests duckdb, ml-dtypes, pandas, pillow, polars, pytestCheckHook, tqdm, }: buildPythonPackage rec { pname = "pylance"; version = "0.26.1"; pyproject = true; src = fetchFromGitHub { owner = "lancedb"; repo = "lance"; tag = "v${version}"; hash = "sha256-peTfrSDByfqg3jiSK8FZr7m+/Mu/mCqeZhR/902Qp4s="; }; sourceRoot = "${src.name}/python"; cargoDeps = rustPlatform.fetchCargoVendor { inherit pname version src sourceRoot ; hash = "sha256-UZ2a7bhK+rJ2jMw9hqyfHjfGRrmG/eB7thjkfguU11o="; }; nativeBuildInputs = [ pkg-config protobuf # for protoc rustPlatform.cargoSetupHook ]; build-system = [ rustPlatform.cargoSetupHook rustPlatform.maturinBuildHook ]; buildInputs = [ openssl protobuf ]; pythonRelaxDeps = [ "pyarrow" ]; dependencies = [ numpy pyarrow ]; optional-dependencies = { torch = [ torch ]; }; pythonImportsCheck = [ "lance" ]; nativeCheckInputs = [ duckdb ml-dtypes pandas pillow polars pytestCheckHook tqdm ] ++ optional-dependencies.torch; preCheck = '' cd python/tests ''; disabledTests = [ # Writes to read-only build directory "test_add_data_storage_version" "test_fix_data_storage_version" ] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ # OSError: LanceError(IO): Resources exhausted: Failed to allocate additional 1245184 bytes for ExternalSorter[0]... "test_merge_insert_large" ]; meta = { description = "Python wrapper for Lance columnar format"; homepage = "https://github.com/lancedb/lance"; changelog = "https://github.com/lancedb/lance/releases/tag/v${version}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ natsukium ]; }; }