1{ autoPatchelfHook
2, buildPythonPackage
3, fetchPypi
4, lib
5, numpy
6, python
7, stdenv
8}:
9
10let
11 pythonVersionNoDot = builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
12 systemToPlatform = {
13 "x86_64-linux" = "manylinux_2_17_x86_64.manylinux2014_x86_64";
14 "aarch64-darwin" = "macosx_11_0_arm64";
15 };
16 hashes = {
17 "310-x86_64-linux" = "sha256-Zuy2zBLV950CMbdtpLNpIWqnXHw2jkjrZG48eGtm42w=";
18 "311-x86_64-linux" = "sha256-Bg5j8QB5z8Ju4bEQsZDojJHTJ4UoQF1pkd4ma83Sc/s=";
19 "310-aarch64-darwin" = "sha256-6Tta4ru1TnobFa4FXWz8fm9rAxF0G09Y2Pj/KaQPVnE=";
20 "311-aarch64-darwin" = "sha256-Sb0tv9ZPQJ4n9b0ybpjJWpreQPZvSC5Sd7CXuUwHCn0=";
21 };
22in
23buildPythonPackage rec {
24 pname = "tensorstore";
25 version = "0.1.40";
26 format = "wheel";
27
28 # The source build involves some wonky Bazel stuff.
29 src = fetchPypi {
30 inherit pname version;
31 format = "wheel";
32 python = "cp${pythonVersionNoDot}";
33 abi = "cp${pythonVersionNoDot}";
34 dist = "cp${pythonVersionNoDot}";
35 platform = systemToPlatform.${stdenv.system} or (throw "unsupported system");
36 hash = hashes."${pythonVersionNoDot}-${stdenv.system}" or (throw "unsupported system/python version combination");
37 };
38
39 nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
40
41 propagatedBuildInputs = [ numpy ];
42
43 pythonImportsCheck = [ "tensorstore" ];
44
45 meta = with lib; {
46 description = "Library for reading and writing large multi-dimensional arrays";
47 homepage = "https://google.github.io/tensorstore";
48 changelog = "https://github.com/google/tensorstore/releases/tag/v${version}";
49 license = licenses.asl20;
50 sourceProvenance = [ sourceTypes.binaryNativeCode ];
51 maintainers = with maintainers; [ samuela ];
52 };
53}