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