1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 # needed to build
7 cython,
8 extension-helpers,
9 oldest-supported-numpy,
10 setuptools,
11 setuptools-scm,
12 # needed to run
13 astropy,
14 numpy,
15 pyparsing,
16 # needed to check
17 pytestCheckHook,
18 pytest-astropy,
19}:
20
21buildPythonPackage rec {
22 pname = "pyregion";
23 version = "2.3.0";
24 pyproject = true;
25
26 # pypi src contains cython-produced .c files which don't compile
27 # with python3.9
28 src = fetchFromGitHub {
29 owner = "astropy";
30 repo = "pyregion";
31 tag = "v${version}";
32 hash = "sha256-mEO2PbUSTVy7Qmm723/lGL6PYQzbRazIPZH51SWebvs=";
33 };
34
35 dependencies = [
36 astropy
37 numpy
38 pyparsing
39 ];
40
41 build-system = [
42 cython
43 extension-helpers
44 oldest-supported-numpy
45 setuptools
46 setuptools-scm
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 pytest-astropy
52 ];
53
54 # Tests must be run in the build directory
55 preCheck = ''
56 pushd build/lib.*
57 '';
58 postCheck = ''
59 popd
60 '';
61
62 meta = with lib; {
63 changelog = "https://github.com/astropy/pyregion/blob/${src.tag}/CHANGES.rst";
64 description = "Python parser for ds9 region files";
65 homepage = "https://github.com/astropy/pyregion";
66 license = licenses.mit;
67 maintainers = [ maintainers.smaret ];
68 };
69}