1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 fetchPypi,
7
8 # build-system
9 setuptools-scm,
10
11 # dependencies
12 astropy,
13 casa-formats-io,
14 dask,
15 joblib,
16 looseversion,
17 radio-beam,
18
19 # checks
20 aplpy,
21 pytest-astropy,
22 pytestCheckHook,
23}:
24
25buildPythonPackage rec {
26 pname = "spectral-cube";
27 version = "0.6.5";
28 pyproject = true;
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchPypi {
33 inherit pname version;
34 hash = "sha256-gJzrr3+/FsQN/HHDERxf/NECArwOaTqFwmI/Q2Z9HTM=";
35 };
36
37 patches = [ ./distutils-looseversion.patch ];
38
39 build-system = [ setuptools-scm ];
40
41 dependencies = [
42 astropy
43 casa-formats-io
44 dask
45 joblib
46 looseversion
47 radio-beam
48 ];
49
50 nativeCheckInputs = [
51 aplpy
52 pytest-astropy
53 pytestCheckHook
54 ];
55
56 # Tests must be run in the build directory.
57 preCheck = ''
58 cd build/lib
59 '';
60
61 # On x86_darwin, this test fails with "Fatal Python error: Aborted"
62 # when sandbox = true.
63 disabledTestPaths = lib.optionals stdenv.isDarwin [ "spectral_cube/tests/test_visualization.py" ];
64
65 pythonImportsCheck = [ "spectral_cube" ];
66
67 meta = {
68 description = "Library for reading and analyzing astrophysical spectral data cubes";
69 homepage = "https://spectral-cube.readthedocs.io";
70 changelog = "https://github.com/radio-astro-tools/spectral-cube/releases/tag/v${version}";
71 license = lib.licenses.bsd3;
72 maintainers = with lib.maintainers; [ smaret ];
73 };
74}