1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, jinja2
6, oldest-supported-numpy
7, setuptools-scm
8, wheel
9, liberfa
10, packaging
11, numpy
12, pytestCheckHook
13, pytest-doctestplus
14}:
15
16buildPythonPackage rec {
17 pname = "pyerfa";
18 format = "pyproject";
19 version = "2.0.0.3";
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-13+7+lg1DBlMy5nl2TqgXTwrFNWq2LZi2Txq2f/0Hzk=";
24 };
25
26 patches = [
27 # Sort of helps maybe for https://github.com/liberfa/pyerfa/issues/112
28 (fetchpatch {
29 url = "https://github.com/liberfa/pyerfa/commit/4866342b94c5e7344711146f1186a4c3e7534da8.patch";
30 hash = "sha256-uPFFdLYfRweQdeEApBAw6Ulqh31NTQwwmnaU+x/M+C0=";
31 })
32 ];
33
34 nativeBuildInputs = [
35 jinja2
36 oldest-supported-numpy
37 packaging
38 setuptools-scm
39 wheel
40 ];
41
42 propagatedBuildInputs = [
43 numpy
44 ];
45 buildInputs = [
46 liberfa
47 ];
48
49 preBuild = ''
50 export PYERFA_USE_SYSTEM_LIBERFA=1
51 '';
52
53 # See https://github.com/liberfa/pyerfa/issues/112#issuecomment-1721197483
54 NIX_CFLAGS_COMPILE = "-O2";
55 nativeCheckInputs = [
56 pytestCheckHook
57 pytest-doctestplus
58 ];
59 # Getting circular import errors without this, not clear yet why. This was mentioned to
60 # upstream at: https://github.com/liberfa/pyerfa/issues/112 and downstream at
61 # https://github.com/NixOS/nixpkgs/issues/255262
62 preCheck = ''
63 cd $out
64 '';
65 pythonImportsCheck = [
66 "erfa"
67 ];
68
69 meta = with lib; {
70 description = "Python bindings for ERFA routines";
71 longDescription = ''
72 PyERFA is the Python wrapper for the ERFA library (Essential Routines
73 for Fundamental Astronomy), a C library containing key algorithms for
74 astronomy, which is based on the SOFA library published by the
75 International Astronomical Union (IAU). All C routines are wrapped as
76 Numpy universal functions, so that they can be called with scalar or
77 array inputs.
78 '';
79 homepage = "https://github.com/liberfa/pyerfa";
80 license = licenses.bsd3;
81 maintainers = [ maintainers.rmcgibbo ];
82 };
83}