2024-07-27 06:49:29 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-09-19 14:19:46 +00:00
|
|
|
rustPlatform,
|
|
|
|
|
|
|
|
# nativeBuildInputs
|
2024-07-27 06:49:29 +00:00
|
|
|
pkg-config,
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
# buildInputs
|
|
|
|
libiconv,
|
2024-07-27 06:49:29 +00:00
|
|
|
protobuf,
|
2024-09-19 14:19:46 +00:00
|
|
|
darwin,
|
|
|
|
|
|
|
|
# dependencies
|
2024-07-27 06:49:29 +00:00
|
|
|
numpy,
|
|
|
|
pyarrow,
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
# optional-dependencies
|
|
|
|
torch,
|
|
|
|
|
|
|
|
# tests
|
|
|
|
duckdb,
|
2024-07-27 06:49:29 +00:00
|
|
|
ml-dtypes,
|
|
|
|
pandas,
|
|
|
|
pillow,
|
|
|
|
polars,
|
|
|
|
pytestCheckHook,
|
|
|
|
tqdm,
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
# passthru
|
|
|
|
nix-update-script,
|
2024-07-27 06:49:29 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pylance";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.17.0";
|
2024-07-27 06:49:29 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lancedb";
|
|
|
|
repo = "lance";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-E+29CbVNbzmrQnBZt0860IvL4xYZqzE+uzSuKDwgxzg=";
|
2024-07-27 06:49:29 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
buildAndTestSubdir = "python";
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin (
|
2024-07-27 06:49:29 +00:00
|
|
|
with darwin.apple_sdk.frameworks;
|
|
|
|
[
|
|
|
|
Security
|
|
|
|
SystemConfiguration
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
pythonRelaxDeps = [ "pyarrow" ];
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
numpy
|
|
|
|
pyarrow
|
|
|
|
];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
optional-dependencies = {
|
|
|
|
torch = [ torch ];
|
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
pythonImportsCheck = [ "lance" ];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
2024-09-19 14:19:46 +00:00
|
|
|
duckdb
|
2024-07-27 06:49:29 +00:00
|
|
|
ml-dtypes
|
|
|
|
pandas
|
|
|
|
pillow
|
|
|
|
polars
|
|
|
|
pytestCheckHook
|
|
|
|
tqdm
|
2024-09-19 14:19:46 +00:00
|
|
|
] ++ optional-dependencies.torch;
|
2024-07-27 06:49:29 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
2024-09-19 14:19:46 +00:00
|
|
|
cd python/python/tests
|
2024-07-27 06:49:29 +00:00
|
|
|
'';
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
disabledTests =
|
|
|
|
lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
# AttributeError: module 'torch.distributed' has no attribute 'is_initialized'
|
|
|
|
"test_convert_int_tensors"
|
|
|
|
"test_ground_truth"
|
|
|
|
"test_index_cast_centroids"
|
|
|
|
"test_index_with_no_centroid_movement"
|
|
|
|
"test_iter_filter"
|
|
|
|
"test_iter_over_dataset_fixed_shape_tensor"
|
|
|
|
"test_iter_over_dataset_fixed_size_lists"
|
|
|
|
]
|
|
|
|
++ [
|
|
|
|
# incompatible with duckdb 1.1.1
|
|
|
|
"test_duckdb_pushdown_extension_types"
|
|
|
|
];
|
2024-07-27 06:49:29 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
passthru.updateScript = nix-update-script {
|
|
|
|
extraArgs = [
|
|
|
|
"--generate-lockfile"
|
|
|
|
"--lockfile-metadata-path"
|
|
|
|
"python"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
meta = {
|
|
|
|
description = "Python wrapper for Lance columnar format";
|
|
|
|
homepage = "https://github.com/lancedb/lance";
|
2024-09-19 14:19:46 +00:00
|
|
|
changelog = "https://github.com/lancedb/lance/releases/tag/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = with lib.maintainers; [ natsukium ];
|
2024-09-19 14:19:46 +00:00
|
|
|
# test_indices.py ...sss.Fatal Python error: Fatal Python error: Illegal instructionIllegal instruction
|
|
|
|
# File "/nix/store/wiiccrs0vd1qbh4j6ki9p40xmamsjix3-python3.12-pylance-0.17.0/lib/python3.12/site-packages/lance/indices.py", line 237 in train_ivf
|
2024-09-26 11:04:55 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;
|
2024-07-27 06:49:29 +00:00
|
|
|
};
|
|
|
|
}
|