1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, aplpy
5, astropy
6, radio_beam
7, pytest
8, pytest-astropy
9, astropy-helpers
10}:
11
12buildPythonPackage rec {
13 pname = "spectral-cube";
14 version = "0.4.5";
15
16 # Fetch from GitHub instead of PyPi, as 0.4.5 isn't available in PyPi
17 src = fetchFromGitHub {
18 owner = "radio-astro-tools";
19 repo = pname;
20 rev = "v${version}";
21 sha256 = "1xc1m6vpl0bm600fx9vypa7zcvwg7yvhgn0w89y6v9d1vl0qcs7z";
22 };
23
24 propagatedBuildInputs = [ astropy radio_beam ];
25
26 nativeBuildInputs = [ astropy-helpers ];
27
28 checkInputs = [ aplpy pytest pytest-astropy ];
29
30 # Disable automatic update of the astropy-helper module
31 postPatch = ''
32 substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
33 '';
34
35 # Tests must be run in the build directory
36 checkPhase = ''
37 cd build/lib
38 pytest
39 '';
40
41 meta = {
42 description = "Library for reading and analyzing astrophysical spectral data cubes";
43 homepage = "http://radio-astro-tools.github.io";
44 license = lib.licenses.bsd3;
45 platforms = lib.platforms.all;
46 maintainers = with lib.maintainers; [ smaret ];
47 };
48}
49