1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 setuptools, 6 importlib-metadata, 7 numpy, 8 rpyc, 9 scipy, 10 appdirs, 11 callPackage, 12}: 13 14buildPythonPackage rec { 15 pname = "linien-common"; 16 version = "2.1.0"; 17 pyproject = true; 18 19 src = fetchFromGitHub { 20 owner = "linien-org"; 21 repo = "linien"; 22 tag = "v${version}"; 23 hash = "sha256-j6oiP/usLfV5HZtKLcXQ5pHhhxRG05kP2FMwingiWm0="; 24 }; 25 26 sourceRoot = "${src.name}/linien-common"; 27 28 preBuild = '' 29 export HOME=$(mktemp -d) 30 ''; 31 32 build-system = [ setuptools ]; 33 34 pythonRelaxDeps = [ 35 "importlib-metadata" 36 "numpy" 37 ]; 38 39 dependencies = [ 40 importlib-metadata 41 numpy 42 rpyc 43 scipy 44 appdirs 45 ]; 46 47 pythonImportsCheck = [ "linien_common" ]; 48 49 passthru.tests = { 50 pytest = callPackage ./tests.nix { }; 51 }; 52 53 meta = { 54 description = "Shared components of the Linien spectroscopy lock application"; 55 homepage = "https://github.com/linien-org/linien/tree/develop/linien-common"; 56 changelog = "https://github.com/linien-org/linien/blob/v${version}/CHANGELOG.md"; 57 license = lib.licenses.gpl3Plus; 58 maintainers = with lib.maintainers; [ 59 fsagbuya 60 doronbehar 61 ]; 62 # Numpy 2 is not supported yet, because the server linien, (installed on the 63 # RedPitaya) must use the same Numpy version as the client (installed with 64 # Nix). The server linien is bound to use Numpy 1 because Numpy maintainers 65 # don't distribute pre-built wheels for the armv7l architecture of 66 # RedPitaya, and it is unfeasible to build it natively there - something 67 # that `pip install numpy` naively tries to do. Hence, we are bound to use 68 # on the server the preinstalled Numpy 1 sourced in the .deb package that 69 # comes with the RedPitaya OS. See also: 70 # 71 # - https://github.com/linien-org/linien/commit/ebbb2276b500a18826d11893bb43699b65692c5e 72 # - https://github.com/linien-org/linien/issues/377 73 # 74 # To evaluate this package with python3.withPackages, use: 75 # 76 # pythonEnv = pkgs.linien-gui.passthru.python.withPackages(ps: { 77 # ps.linien-common 78 # # Other packages... 79 # }); 80 # 81 # NOTE that the above Python environment will use Numpy 1 throughout all 82 # packages wrapped there (see expression in linien-gui), and this may 83 # trigger rebuilds for dependencies that depend on Numpy too. Be ready to 84 # also add more `packageOverrides` to make sure these other dependencies do 85 # build with numpy_1. 86 # 87 # Last NOTE: If you need more packageOverrides besides those provided in 88 # the `linien-gui` expression, beware of: 89 # 90 # - https://github.com/NixOS/nixpkgs/issues/44426 91 broken = lib.versionAtLeast numpy.version "2"; 92 }; 93}