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 "x86_64-linux" = "manylinux_2_17_x86_64.manylinux2014_x86_64"; 16 "aarch64-darwin" = "macosx_11_0_arm64"; 17 }; 18 hashes = { 19 "310-x86_64-linux" = "sha256-1b6w9wgT6fffTTpJ3MxdPSrFD7Xaby6prQYFljVn4x4="; 20 "311-x86_64-linux" = "sha256-8+HlzaxH30gB5N+ZKR0Oq+yswhq5gjiSF9jVsg8U22E="; 21 "312-x86_64-linux" = "sha256-e8iEQzB4D3RSXgrcPC4me/vsFKoXf1QFNZfQ7968zQE="; 22 "310-aarch64-darwin" = "sha256-2C60yJk/Pbx2woV7hzEmWGzNKWWnySDfTPm247PWIRA="; 23 "311-aarch64-darwin" = "sha256-rdLB7l/8ZYjV589qKtORiyu1rC7W30wzrsz1uihNRpk="; 24 "312-aarch64-darwin" = "sha256-DpbYMIbqceQeiL7PYwnvn9jLtv8EmfHXmxvPfZCw914="; 25 }; 26in 27buildPythonPackage rec { 28 pname = "tensorstore"; 29 version = "0.1.53"; 30 format = "wheel"; 31 32 # The source build involves some wonky Bazel stuff. 33 src = fetchPypi { 34 inherit pname version; 35 format = "wheel"; 36 python = "cp${pythonVersionNoDot}"; 37 abi = "cp${pythonVersionNoDot}"; 38 dist = "cp${pythonVersionNoDot}"; 39 platform = systemToPlatform.${stdenv.system} or (throw "unsupported system"); 40 hash = 41 hashes."${pythonVersionNoDot}-${stdenv.system}" 42 or (throw "unsupported system/python version combination"); 43 }; 44 45 nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; 46 47 propagatedBuildInputs = [ 48 ml-dtypes 49 numpy 50 ]; 51 52 pythonImportsCheck = [ "tensorstore" ]; 53 54 meta = with lib; { 55 description = "Library for reading and writing large multi-dimensional arrays"; 56 homepage = "https://google.github.io/tensorstore"; 57 changelog = "https://github.com/google/tensorstore/releases/tag/v${version}"; 58 license = licenses.asl20; 59 sourceProvenance = [ sourceTypes.binaryNativeCode ]; 60 maintainers = with maintainers; [ samuela ]; 61 }; 62}