1{
2 lib,
3 stdenv,
4 asdf,
5 astropy,
6 astropy-extension-helpers,
7 astropy-helpers,
8 beautifulsoup4,
9 buildPythonPackage,
10 drms,
11 fetchPypi,
12 glymur,
13 h5netcdf,
14 hypothesis,
15 lxml,
16 matplotlib,
17 numpy,
18 pandas,
19 parfive,
20 pytest-astropy,
21 pytestCheckHook,
22 pytest-mock,
23 python-dateutil,
24 pythonOlder,
25 scikit-image,
26 scipy,
27 setuptools-scm,
28 sqlalchemy,
29 tqdm,
30 zeep,
31}:
32
33buildPythonPackage rec {
34 pname = "sunpy";
35 version = "5.1.4";
36 format = "setuptools";
37
38 disabled = pythonOlder "3.8";
39
40 src = fetchPypi {
41 inherit pname version;
42 hash = "sha256-y+tw1I+C6wDFlJvObWrOhisrryQCeXulkwFyRCuAgTA=";
43 };
44
45 nativeBuildInputs = [
46 astropy-extension-helpers
47 setuptools-scm
48 ];
49
50 propagatedBuildInputs = [
51 astropy
52 astropy-helpers
53 numpy
54 parfive
55 ];
56
57 passthru.optional-dependencies = {
58 asdf = [
59 asdf
60 # asdf-astropy
61 ];
62 database = [ sqlalchemy ];
63 image = [
64 scikit-image
65 scipy
66 ];
67 net = [
68 beautifulsoup4
69 drms
70 python-dateutil
71 tqdm
72 zeep
73 ];
74 jpeg2000 = [
75 glymur
76 lxml
77 ];
78 timeseries = [
79 # cdflib
80 h5netcdf
81 # h5py
82 matplotlib
83 pandas
84 ];
85 };
86
87 nativeCheckInputs =
88 [
89 hypothesis
90 pytest-astropy
91 pytest-mock
92 pytestCheckHook
93 ]
94 ++ passthru.optional-dependencies.asdf
95 ++ passthru.optional-dependencies.database
96 ++ passthru.optional-dependencies.image
97 ++ passthru.optional-dependencies.net
98 ++ passthru.optional-dependencies.timeseries;
99
100 postPatch = ''
101 substituteInPlace setup.cfg \
102 --replace " --dist no" ""
103 '';
104
105 # darwin has write permission issues
106 doCheck = stdenv.isLinux;
107
108 preCheck = ''
109 export HOME=$(mktemp -d)
110 '';
111
112 disabledTests = [
113 "rst"
114 "test_sunpy_warnings_logging"
115 "test_main_nonexisting_module"
116 "test_main_stdlib_module"
117 "test_find_dependencies"
118 ];
119
120 disabledTestPaths = [
121 # Tests are very slow
122 "sunpy/net/tests/test_fido.py"
123 # asdf.extensions plugin issue
124 "sunpy/io/special/asdf/resources/schemas/"
125 "sunpy/io/special/asdf/resources/manifests/sunpy-1.0.0.yaml"
126 # Requires mpl-animators package
127 "sunpy/map/tests/test_compositemap.py"
128 "sunpy/map/tests/test_mapbase.py"
129 "sunpy/map/tests/test_mapsequence.py"
130 "sunpy/map/tests/test_plotting.py"
131 "sunpy/map/tests/test_reproject_to.py"
132 "sunpy/net/tests/test_helioviewer.py"
133 "sunpy/timeseries/tests/test_timeseriesbase.py"
134 "sunpy/visualization/animator/tests/test_basefuncanimator.py"
135 "sunpy/visualization/animator/tests/test_mapsequenceanimator.py"
136 "sunpy/visualization/animator/tests/test_wcs.py"
137 "sunpy/visualization/colormaps/tests/test_cm.py"
138 # Requires cdflib package
139 "sunpy/timeseries/tests/test_timeseries_factory.py"
140 # Requires jplephem
141 "sunpy/image/tests/test_transform.py"
142 "sunpy/io/special/asdf/tests/test_coordinate_frames.py"
143 "sunpy/io/special/asdf/tests/test_genericmap.py"
144 # distutils is deprecated
145 "sunpy/io/setup_package.py"
146 ];
147
148 pytestFlagsArray = [
149 "-W"
150 "ignore::DeprecationWarning"
151 ];
152
153 # Wants a configuration file
154 # pythonImportsCheck = [
155 # "sunpy"
156 # ];
157
158 meta = with lib; {
159 description = "Python for Solar Physics";
160 homepage = "https://sunpy.org";
161 license = licenses.bsd2;
162 maintainers = [ ];
163 broken = true;
164 };
165}