nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 autoPatchelfHook,
3 buildPythonPackage,
4 fetchPypi,
5 lib,
6 ml-dtypes,
7 numpy,
8 python,
9 stdenv,
10}:
11
12let
13 pythonVersionNoDot = builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
14 systemToPlatform = {
15 "aarch64-linux" = "manylinux_2_27_aarch64.manylinux_2_28_aarch64";
16 "x86_64-linux" = "manylinux_2_27_x86_64.manylinux_2_28_x86_64";
17 "aarch64-darwin" = "macosx_11_0_arm64";
18 };
19 hashes = {
20 "311-x86_64-linux" = "sha256-gwcu4OVR1tylguFUtkyLgGbSduwHWXhOMUnCghKmHxg=";
21 "312-x86_64-linux" = "sha256-YI9xeOxuTko8JlRbCkT0S/g0ONBL8tlgzQ52meqpnvY=";
22 "313-x86_64-linux" = "sha256-yfLcM0LkaGr5j24lncn7N38b9le2ScJHv2ZHu+T5gJA=";
23 "314-x86_64-linux" = "sha256-evlCImnCv83s+d1VMJBgZlq5wtf2yJI3ftMsAyQA/uo=";
24 "311-aarch64-linux" = "sha256-xCMLj9KXleiORB90nYgZc+yo2t8zxSYrNng5+4iR95s=";
25 "312-aarch64-linux" = "sha256-3r1DUELAC+aLofs89ZMlp7q7P0o89HRMh93jRoAsu7Q=";
26 "313-aarch64-linux" = "sha256-lNj8nfFyGwKHBGrKcgn9UECInK1CAue3Oh/bd82bccY=";
27 "314-aarch64-linux" = "sha256-hHmCZSJz+3staUt4kgV0eq8+UK5kc4xct7XrA9hqmUc=";
28 "311-aarch64-darwin" = "sha256-XhUtM0vzT7q9/o5bw1uH0fmUcGWST/g8KeZZMIs26Ug=";
29 "312-aarch64-darwin" = "sha256-EIwOhnqiyH1JgsxjJaLeDE9b1jwr6hitsZOjcMQFlM4=";
30 "313-aarch64-darwin" = "sha256-Kc9DNhU68TasisUo4u1G3xk2ftrn4U43vKGot8SEjvI=";
31 "314-aarch64-darwin" = "sha256-l3VtLLo8XOIeFWAsKvWgJSHMDs2n+fttGNovO9UYJ/Q=";
32 };
33in
34buildPythonPackage rec {
35 pname = "tensorstore";
36 version = "0.1.79";
37 format = "wheel";
38
39 # The source build involves some wonky Bazel stuff.
40 src = fetchPypi {
41 inherit pname version;
42 format = "wheel";
43 python = "cp${pythonVersionNoDot}";
44 abi = "cp${pythonVersionNoDot}";
45 dist = "cp${pythonVersionNoDot}";
46 platform = systemToPlatform.${stdenv.system} or (throw "unsupported system");
47 hash =
48 hashes."${pythonVersionNoDot}-${stdenv.system}"
49 or (throw "unsupported system/python version combination");
50 };
51
52 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
53
54 dependencies = [
55 ml-dtypes
56 numpy
57 ];
58
59 pythonImportsCheck = [ "tensorstore" ];
60
61 meta = {
62 description = "Library for reading and writing large multi-dimensional arrays";
63 homepage = "https://google.github.io/tensorstore";
64 changelog = "https://github.com/google/tensorstore/releases/tag/v${version}";
65 license = lib.licenses.asl20;
66 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
67 maintainers = with lib.maintainers; [ samuela ];
68 };
69}