1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, numpy
6, astropy
7, astropy-helpers
8, matplotlib
9, reproject
10, pyavm
11, pyregion
12, pillow
13, scikitimage
14, shapely
15, pytest
16, pytest-astropy
17}:
18
19buildPythonPackage rec {
20 pname = "aplpy";
21 version = "2.0.3";
22 format = "pyproject";
23
24 src = fetchPypi {
25 pname = "APLpy";
26 inherit version;
27 sha256 = "239f3d83635ca4251536aeb577df7c60df77fc4d658097b92094719739aec3f3";
28 };
29
30 patches = [
31 # Fixes compatibility with astropy-helpers. This patch has been merged into
32 # the master branch as of May 2020, and should be part of the next
33 # upstream release (v2.0.3 was tagged in Feb. 2019).
34 (fetchpatch {
35 url = "https://github.com/aplpy/aplpy/pull/448.patch";
36 sha256 = "1pnzh7ykjc8hwahzbzyryrzv5a8fddgd1bmzbhagkrn6lmvhhpvq";
37 excludes = [ "tox.ini" "azure-pipelines.yml" ".circleci/config.yml" "MANIFEST.in" ".gitignore"
38 "setup.cfg" "appveyor.yml" "readthedocs.yml" "CHANGES.rst" ".gitmodules" ".travis.yml" "astropy_helpers" ];
39 })
40 # Fix for matplotlib >= 3.4 (https://github.com/aplpy/aplpy/pull/466)
41 # Note: because of a security thing, github will refuse to serve this patch from the
42 # "normal" location
43 # (https://github.com/aplpy/aplpy/commit/56c1cc694fdea69e7da8506d3212c4495adb0ca5.patch)
44 # due to the fact that it contains the PDF magic bytes, but it will serve it from
45 # this githubusercontent domain.
46 (fetchpatch {
47 url = "https://patch-diff.githubusercontent.com/raw/aplpy/aplpy/pull/466/commit/56c1cc694fdea69e7da8506d3212c4495adb0ca5.patch";
48 sha256 = "0jna2n1cgfzr0a27m5z94wwph7qg25hs7lycrdb2dp3943rb35g4";
49 })
50 ];
51
52 propagatedBuildInputs = [
53 numpy
54 astropy
55 matplotlib
56 reproject
57 pyavm
58 pyregion
59 pillow
60 scikitimage
61 shapely
62 ];
63
64 nativeBuildInputs = [ astropy-helpers ];
65 checkInputs = [ pytest pytest-astropy ];
66
67 checkPhase = ''
68 OPENMP_EXPECTED=0 pytest aplpy
69 '';
70
71 meta = with lib; {
72 description = "The Astronomical Plotting Library in Python";
73 homepage = "http://aplpy.github.io";
74 license = licenses.mit;
75 maintainers = [ maintainers.smaret ];
76 };
77}