1{
2 lib,
3 astropy,
4 buildPythonPackage,
5 fetchpatch,
6 fetchPypi,
7 matplotlib,
8 numpy,
9 pillow,
10 pyavm,
11 pyregion,
12 pytest-astropy,
13 pytestCheckHook,
14 pythonOlder,
15 reproject,
16 scikit-image,
17 setuptools,
18 setuptools-scm,
19 shapely,
20 wheel,
21}:
22
23buildPythonPackage rec {
24 pname = "aplpy";
25 version = "2.1.0";
26 format = "pyproject";
27
28 disabled = pythonOlder "3.6";
29
30 src = fetchPypi {
31 pname = "aplpy";
32 inherit version;
33 hash = "sha256-KCdmBwQWt7IfHsjq7pWlbSISEpfQZDyt+SQSTDaUCV4=";
34 };
35
36 # Fix build with Astropy 6.1, Python 3.12 and matplotlib 3.9
37 patches = [
38 # https://github.com/aplpy/aplpy/pull/496
39 (fetchpatch {
40 url = "https://github.com/aplpy/aplpy/commit/d232a4984bc6a83ec86dfdc3ab3bc1b05de44c48.patch";
41 hash = "sha256-jGUTzIrVdGNPy0BV8w46jzz045fDXBisiwIn90bn7oY=";
42 })
43 # https://github.com/aplpy/aplpy/pull/497
44 (fetchpatch {
45 url = "https://github.com/aplpy/aplpy/commit/468be394970b39f1aaa6debef51eb674e2dd86d8.patch";
46 hash = "sha256-/ovLrFOKb3RQ8TZSviuOV6EYNgz0gtrhVWZLFJBrzFg=";
47 })
48 # https://github.com/aplpy/aplpy/pull/500
49 (fetchpatch {
50 url = "https://github.com/aplpy/aplpy/commit/c9049261b3724821f4d309d85fe73cabcc04d890.patch";
51 hash = "sha256-ivdXLh1Z+WG3EL5u1wO+lqz6X1AP6WpyoZix5YiqW0w=";
52 })
53 # https://github.com/aplpy/aplpy/pull/503
54 (fetchpatch {
55 url = "https://github.com/aplpy/aplpy/commit/edc2aa9770b72bd3ac42db95a6e027b276be9c31.patch";
56 hash = "sha256-QUZenY3XQ/T2tl5apxZUqjf4ACjOzJWb+1AUp5limi4=";
57 })
58 ];
59
60 nativeBuildInputs = [
61 setuptools
62 setuptools-scm
63 wheel
64 ];
65
66 propagatedBuildInputs = [
67 astropy
68 matplotlib
69 numpy
70 pillow
71 pyavm
72 pyregion
73 reproject
74 scikit-image
75 shapely
76 ];
77
78 nativeCheckInputs = [
79 pytest-astropy
80 pytestCheckHook
81 ];
82
83 preCheck = ''
84 OPENMP_EXPECTED=0
85 '';
86
87 pythonImportsCheck = [ "aplpy" ];
88
89 meta = with lib; {
90 description = "Astronomical Plotting Library in Python";
91 homepage = "http://aplpy.github.io";
92 license = licenses.mit;
93 maintainers = with maintainers; [ smaret ];
94 };
95}