Files
nixpkgs/pkgs/development/python-modules/lancedb/default.nix
T
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

131 lines
2.4 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
rustPlatform,
fetchFromGitHub,
darwin,
libiconv,
pkg-config,
protobuf,
attrs,
cachetools,
deprecation,
overrides,
packaging,
pydantic,
pylance,
requests,
retry,
tqdm,
aiohttp,
pandas,
polars,
pytest-asyncio,
pytestCheckHook,
nix-update-script,
}:
buildPythonPackage rec {
pname = "lancedb";
version = "0.13.0";
pyproject = true;
src = fetchFromGitHub {
owner = "lancedb";
repo = "lancedb";
rev = "refs/tags/python-v${version}";
hash = "sha256-6E20WgyoEALdxmiOfgq89dCkqovvIMzc/wy+kvjDWwU=";
};
buildAndTestSubdir = "python";
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
build-system = [ rustPlatform.maturinBuildHook ];
nativeBuildInputs = [
pkg-config
rustPlatform.cargoSetupHook
];
buildInputs =
[
libiconv
protobuf
]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
IOKit
Security
SystemConfiguration
]
);
dependencies = [
attrs
cachetools
deprecation
overrides
packaging
pydantic
pylance
requests
retry
tqdm
];
pythonImportsCheck = [ "lancedb" ];
nativeCheckInputs = [
aiohttp
pandas
polars
pytest-asyncio
pytestCheckHook
];
preCheck = ''
cd python/python/tests
'';
pytestFlagsArray = [ "-m 'not slow'" ];
disabledTests = [
# require tantivy which is not packaged in nixpkgs
"test_basic"
# polars.exceptions.ComputeError: TypeError: _scan_pyarrow_dataset_impl() got multiple values for argument 'batch_size'
# https://github.com/lancedb/lancedb/issues/1539
"test_polars"
];
disabledTestPaths = [
# touch the network
"test_s3.py"
];
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"python-v(.*)"
"--generate-lockfile"
"--lockfile-metadata-path"
"python"
];
};
meta = {
description = "Developer-friendly, serverless vector database for AI applications";
homepage = "https://github.com/lancedb/lancedb";
changelog = "https://github.com/lancedb/lancedb/releases/tag/python-v${version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ natsukium ];
};
}