nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 extension-helpers,
8 numpy,
9 setuptools,
10 setuptools-scm,
11
12 # dependencies
13 astropy,
14 fsspec,
15 packaging,
16 parfive,
17 pyerfa,
18 requests,
19
20 # optional-dependencies
21 # asdf
22 asdf,
23 asdf-astropy,
24 # dask
25 dask,
26 # image
27 scipy,
28 # jpeg
29 glymur,
30 lxml,
31 # jupyter
32 itables,
33 ipywidgets,
34 # map
35 contourpy,
36 matplotlib,
37 reproject,
38 # net
39 beautifulsoup4,
40 drms,
41 python-dateutil,
42 tqdm,
43 zeep,
44 # opencv
45 opencv-python,
46 # scikit-image
47 scikit-image,
48 # timeseries
49 h5netcdf,
50 h5py,
51 pandas,
52
53 # tests
54 hypothesis,
55 pytest-astropy,
56 pytest-mock,
57 pytestCheckHook,
58 writableTmpDirAsHomeHook,
59}:
60
61buildPythonPackage (finalAttrs: {
62 pname = "sunpy";
63 version = "7.1.0";
64 pyproject = true;
65
66 src = fetchFromGitHub {
67 owner = "sunpy";
68 repo = "sunpy";
69 tag = "v${finalAttrs.version}";
70 hash = "sha256-FeKmg3dZfbbjt1lDliF4uXf8PvM3J5HWtYqKRriJ4l0=";
71 };
72
73 build-system = [
74 extension-helpers
75 numpy
76 setuptools
77 setuptools-scm # Technically needs setuptools-scm[toml], but that's our default.
78 ];
79
80 dependencies = [
81 astropy
82 fsspec
83 numpy
84 packaging
85 parfive
86 pyerfa
87 requests
88 ]
89 ++ parfive.optional-dependencies.ftp;
90
91 optional-dependencies = lib.fix (self: {
92 asdf = [
93 asdf
94 asdf-astropy
95 ];
96 dask = [ dask ] ++ dask.optional-dependencies.array;
97 image = [ scipy ];
98 jpeg2000 = [
99 glymur
100 lxml
101 ];
102 jupyter = [
103 itables
104 ipywidgets
105 ];
106 map = [
107 contourpy
108 matplotlib
109 # mpl-animators
110 reproject
111 scipy
112 ];
113 net = [
114 beautifulsoup4
115 drms
116 python-dateutil
117 tqdm
118 zeep
119 ];
120 opencv = [ opencv-python ];
121 scikit-image = [ scikit-image ];
122 # spice = [ spiceypy ];
123 timeseries = [
124 # cdflib
125 h5netcdf
126 h5py
127 matplotlib
128 pandas
129 ];
130 visualization = [
131 matplotlib
132 # mpl-animators
133 ];
134
135 # We can't use `with` here because "map" would still be the builtin, and
136 # we can't below because scikit-image would still be this package's argument.
137 core = lib.concatLists [
138 self.image
139 self.map
140 self.net
141 self.timeseries
142 self.visualization
143 ];
144 all = lib.concatLists [
145 self.core
146 self.asdf
147 self.jpeg2000
148 self.opencv
149 # optional-dependencies.spice
150 self.scikit-image
151 ];
152 });
153
154 nativeCheckInputs = [
155 hypothesis
156 pytest-astropy
157 pytest-mock
158 pytestCheckHook
159 writableTmpDirAsHomeHook
160 ]
161 ++ finalAttrs.passthru.optional-dependencies.all;
162
163 disabledTests = [
164 "rst" # Docs
165 "test_print_params" # Needs to be online
166 "test_find_dependencies" # Needs cdflib
167 # Needs mpl-animators
168 "sunpy.coordinates.utils.GreatArc"
169 "test_cutout_not_on_disk_when_tracking"
170 "test_expand_list_generator_map"
171 "test_great_arc_different_observer"
172 "test_great_arc_points_differentiates"
173 "test_great_arc_wrongly_formatted_points"
174 "test_main_exclude_remote_data"
175 "test_main_include_remote_data"
176 "test_main_nonexisting_module"
177 "test_main_only_remote_data"
178 "test_main_stdlib_module"
179 "test_main_submodule_map"
180 "test_tai_seconds"
181 "test_utime"
182 ];
183
184 disabledTestPaths = [
185 # Tests are very slow
186 "sunpy/net/tests/test_fido.py"
187 "sunpy/net/tests/test_scraper.py"
188 # asdf.extensions plugin issue
189 "sunpy/io/special/asdf/resources/manifests/*.yaml"
190 "sunpy/io/special/asdf/resources/schemas/"
191 # Requires mpl-animators
192 "sunpy/coordinates/tests/test_wcs_utils.py"
193 "sunpy/image/tests/test_resample.py"
194 "sunpy/image/tests/test_transform.py"
195 "sunpy/io/special/asdf/tests/test_genericmap.py"
196 "sunpy/map"
197 "sunpy/net/jsoc/tests/test_jsoc.py"
198 "sunpy/physics/differential_rotation.py"
199 "sunpy/physics/tests/test_differential_rotation.py"
200 "sunpy/visualization"
201 # Requires cdflib
202 "sunpy/io/tests/test_cdf.py"
203 "sunpy/timeseries"
204 # Requires jplephem
205 "sunpy/io/special/asdf/tests/test_coordinate_frames.py"
206 # Requires spiceypy
207 "sunpy/coordinates/tests/test_spice.py"
208 ];
209
210 pythonImportsCheck = [ "sunpy" ];
211
212 meta = {
213 description = "Python for Solar Physics";
214 homepage = "https://sunpy.org";
215 downloadPage = "https://github.com/sunpy/sunpy";
216 changelog = "https://docs.sunpy.org/en/stable/whatsnew/changelog.html";
217 license = lib.licenses.bsd2;
218 maintainers = [ ];
219 };
220})