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