nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9 setuptools-scm,
10
11 # dependencies
12 astropy,
13 casa-formats-io,
14 dask,
15 joblib,
16 numpy,
17 packaging,
18 radio-beam,
19 tqdm,
20
21 # tests
22 aplpy,
23 pytest-astropy,
24 pytestCheckHook,
25}:
26
27buildPythonPackage rec {
28 pname = "spectral-cube";
29 version = "0.6.7";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "radio-astro-tools";
34 repo = "spectral-cube";
35 tag = "v${version}";
36 hash = "sha256-l5r7oeWr/JrmGOmUo4po2VlGldh8y7E3ufd+Gw1/JmM=";
37 };
38
39 build-system = [
40 setuptools
41 setuptools-scm
42 ];
43
44 dependencies = [
45 astropy
46 casa-formats-io
47 dask
48 joblib
49 numpy
50 packaging
51 radio-beam
52 tqdm
53 ]
54 ++ dask.optional-dependencies.array;
55
56 nativeCheckInputs = [
57 aplpy
58 pytest-astropy
59 pytestCheckHook
60 ];
61
62 # Tests must be run in the build directory.
63 preCheck = ''
64 cd build/lib
65 '';
66
67 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
68 # Flaky: AssertionError: assert diffvals.max()*u.B <= 1*u.MB
69 "test_reproject_3D_memory"
70 ];
71
72 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
73 # On x86_darwin, this test fails with "Fatal Python error: Aborted"
74 # when sandbox = true.
75 "spectral_cube/tests/test_visualization.py"
76 ];
77
78 pythonImportsCheck = [ "spectral_cube" ];
79
80 meta = {
81 description = "Library for reading and analyzing astrophysical spectral data cubes";
82 homepage = "https://spectral-cube.readthedocs.io";
83 changelog = "https://github.com/radio-astro-tools/spectral-cube/releases/tag/v${version}";
84 license = lib.licenses.bsd3;
85 maintainers = with lib.maintainers; [ smaret ];
86 };
87}